Whats memcached all about?
mart at degeneration.co.uk
Sat Sep 2 00:10:18 UTC 2006
Lexington Luthor wrote:
>> 2. What exactly does memcached cache? (What types of objects)
> Arbitrary. It does not care. You give it a chunk of data and a name for
> it (and optionally a time at which to discard it), and later request it
> again. Aside from some support for incrementing and decrementing
> integers, memcached does not at all care what you give it, it will take
> it and happily give it back (unless it expires or is deleted to make
> room for other items, see the -M flag).
I think a better answer here is "hunks of raw data".
In other words, it's the client's responsibility to encoding anything
that isn't just a string into a string before passing it to memcached.
Some client libraries hide this by automatically serializing complex
types like arrays and objects, but that often only works when all
clients are using the same client library.
I assume that the PHP client library puts anything that isn't a string
or an integer through serialize(), and likewise passes anything that's
previously been serialized back through unserialize() on the way out.
The Perl client library uses Storable. The two are not compatible.
More information about the memcached