PlumbersStock.com wrote:
slow data access. I don't store anything very important in cache but I
store a lot of slow to retrieve stuff in cache. I forgot it'd wipe my
Here's an idea you could use to avoid maintaining a forked memcache...
Request handling:
generate cache id
if mc->get(id)
serve from cache
else
generate data
serve data (possibly close client connection here)
mc->store(timestamp + data, id)
*store id to a file*
(*This basically becomes the key list that memcache doesn't have. You'd
want to save the id as fast as possible.)
Shutdown:
switch app to use different memcached server
run script to fetch every id in file and save to disk
shutdown memcached
Startup:
start memcached
run script to re-store() all data from disk
for any data you feel is too old (you'll have the timestamp)
generate it now (or just don't store it)
repoint app to use this memcached
If you want to make shutdown/startup quicker you could have a separate
process (not on user time, and throttled down in peak hours) whose job
is to watch the id list and sync memcached data to more permanent storage.
--
Steve Clay
http://mrclay.org/