caching Radiant::Config

0 views
Skip to first unread message

Jim Gay

unread,
Mar 16, 2009, 2:24:39 PM3/16/09
to radiant...@googlegroups.com
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/2ede58677fca068f57f9f98196b32792abbe370e

But then I thought I might as well use Rails.cache:
http://github.com/saturnflyer/radiant/commit/bf974903e835693ae96302adf5a64421c3a9df28

(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

Reply all
Reply to author
Forward
0 new messages