On Dec 8, 5:53 pm, IvoLucien <[email protected]> wrote:
> To paraphrase what folks have already said with a bit more
> explanation, it is impossible to iterate over memcache(d) keys

  Note that the memcache protocol has a means of iterating keys, but
memcached itself does not.

  I'm not trying to add confusion, but if your parentheses around the
d makes it seem like a fundamental protocol concept.  It's not
appropriate for memcached (the cache), but range and iteration type
commands are specified.

> Has
> anyone heard of a library that implements a key tracking system? I'd
> guess not since that would add overhead, contrary to the main point of
> memcached.

  I've heard of people using things like sphinx, but it's a rather odd
idea since the cache can push out data at any point to keep things
fast and it's hard to keep your search engine synchronized with such
things.

> I've never heard of memcached having any mechanism, even within
> itself, to walk the keys without knowing the key names.

  It's a data structure thing.  memcached is optimized to fast at
accessing your data by name.  It *does* know all of the keys, but
accessing them safely would require preventing other operations from
running.  If we optimize for listing patterns, it'll have to come at a
performance cost of normal operations *and* take more memory.  If you
wanted a consistent view, that would potentially be a very large
amount of memory.

> People
> generally depend on the timeout values to avoid filling memory with
> irrelevant items, and the occasional complete cache flush, usually of
> a fraction of memcache servers in a system, to fully clean up the
> cache.

  You should generally not use timeouts for anything other than
declaring when an object should not be expected to be considered valid
any longer.

  It is definitely not required to avoid running out of memory.  The
reason we say you shouldn't rely on memcached to maintain your data is
because it makes decisions to throw out old things to make room for
new things to ensure it stays fast.  ("old" here meaning based on when
they're accessed)

Reply via email to