How does Card object caching work?
Support Ticket
+issues
I was wondering when Card object caches are rebuilt. When you edit one or when you access it...?
Going to the 'tmp' folder and then 'cache' there are a bunch of numbers and then:
wagn-database%2FCard%2F142784089065fs%2F*all%2B*style
What do the folder numbers mean? 007 or D9E
What does the file number mean? Ex above: F142784089065fs
Do you know what kind of cache entry that is? It might not even be an application cache entry, but a framework entry for rails query caching in active_record.
For a file cache, the directories are just for faster access. Most OSs are not happy with really large directories (linear search is typical), so file store caches will use some sort of hashing to spread the objects into small buckets, or even buckets of buckets. This is to say that those directory numbers are internal to the cache.
Ethan can correct this if it isn't quite right. In general, volatile cache data has a lifetime of the current request, and therefore in will be rebuilt on the next GET after the save. There are some less volatile cached items that you have to clear the cache for, and for some it is automatic.
An example is adding a new codename to the card database. We consider codename to id mapping (and the reverse) to be immutable so that it can just load once and stay loaded. There is likely some special behavior and/or caching around styles ('*all+*style in your example) and javascript (machine cards where we generate output files that can be permanently cached in the browser).
Shorter answer is we have a cache of individual card objects. We rarely rebuild the whole thing; usually a given card is cleared and rebuilt based on relevant actions. (eg card is edited).
We use the standard Rails caching mechanism. I'd have to look at code to figure out what the file/folders mean, but I'm about to go offline until Mon. April 7, so I'm afraid I can't dig into that today. Will look when I get back if Gerry doesn't beat me to it.
D'oh, I'm confusing the psuedo-cache of in-memory cards. Internally we fetch them the same way, but what is call the local-cache is cleared each request.