Write LRU to database
jeetum at gmail.com
Wed Nov 8 08:56:52 UTC 2006
On Wed, 2006-11-08 at 09:01 +0100, Oscar Kené wrote:
> I'm fairly new to memcached.
> As I understand it memcached simply drops the LRU entry when the cache
> is full (if you don't specify it to send an error instead).
> Is there any functionality to make it write these to a mySQL-database
What you want is a on-delete hook.
Even I have wanted this any some instances, but then I think - may be
this is not what memcached is meant to do. Its just a cache :)
> Right now my data is INSERTed, SELECTed only once and then DELETEd. But
> every "set" of data is not handled sequentially. So one "set" of data
> can be INSERTEd but not SELECTed or DELETEd before the entry is subject
> to the "LRU-rule". I.e. I want to keep the most recent "INSERTs" in
> memcache as they are the most likely to be operated on first.
I think you are trying to build a queue out of memcached. Again, this is
not what memcached is meant to do
Moreover, since you are going to select only once and delete it, the
record inserted but not selected is bound to be deleted when memcached
is out of free memory. You could instead add more memcached instances
such that you will lose records in very remote cases.
> I realize that I may have to patch memcached myself but I want to make
> sure before I do it.
More information about the memcached