I'm attempting to remove unnecessary calls to the database for
Radiant::Config (since it doesn't really change that often)
I've created a config_cache branch where I'm trying to solve this and
would love some feedback.
http://github.com/saturnflyer/radiant/tree/config_cache
I talked to Sean on IRC a week or two ago about it and we came up with
the idea to track the mtime on a file in the cache directory so that
multiple threads could know when to load the data from the database.
Originally I just created a hash in memory:
http://github.com/saturnflyer/radiant/commit/2ede58677fca068f57f9f981...
But then I thought I might as well use Rails.cache:
http://github.com/saturnflyer/radiant/commit/bf974903e835693ae96302ad...
(I realize now that I used "fetch" in my specs where it ought to be
"read")
I believe I've got the problem covered:
Only load the records from the database if the cache is stale.
Nullify the cache when the page cache is cleared
Recreate the cache when a Config object is saved
Does anyone see where I may have missed something?
-Jim