Question

I want to store an entire MYSQL result in memcached via libmemcached in C. Is this possible or do I have to store each row element in memcached separately?

Était-ce utile?

La solution

If your result set will always be smaller than 1mb then it's possible to save the entire result set. Otherwise (if your result might be greater than 1mb), you'll have to find another solution. If storing each row in memcache works for you, then that's probably a fine solution.

The 1mb limit for value size is a hard limit coded into memcache. The only way around it is to change the limit in the source code and recompile memcache.

See http://groups.google.com/group/memcached/browse_thread/thread/d32434ce77131e48 for some discussion.

(Note: this is all assuming it is possible to serialize your results into a string; if you can't do that, then you can't store individual rows either, because an array is not a limiting factor on serialization ability.)

Here's a post discussing how to Serialize Data Structures in C

Autres conseils

Definitely you can do it. You have to find a way to pack all the responses together. It doesn't come to me easily why you would want to do that, anyway.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top