mogsie at escenic.com
Thu Feb 2 10:56:22 UTC 2006
I would rather have the inexpensive (O(1)) option of clearing out a
name-space of items by timestamp, as has been suggested several times
earlier. It is much less complex, and mirrors the existing flush_all.
(1) You would add items (optionally to a name space).
(2) flush_all simply sets "last_flush_all = now()"
(3) flush_namespace would set "last_flush[namespace] = now()"
(4) Normal retrieval would have the following logic:
if (timestamp_of_cached_item is older than the last_flush_all) remove
object and return null
(5) Retrieval from a name space, same as (4) and then:
if (timestamp_of_cached_item is older than the last_flush[namespace])
remove object and return null
Internally you would have a table of name spaces and their last flush
You have a little problem with cleaning up the last_flush table, since
you can't be sure that it's safe to remove *really old* entries, and the
table might grow.
More information about the memcached