is it possible to store an array in memcached

Marcus Bointon marcus at
Thu Jan 18 20:43:36 UTC 2007

On 18 Jan 2007, at 20:32, Alan Jay wrote:

> I am doing some tests with the idea to use Memcached to reduce the  
> load on HTML servers.  We want to cache articles which are held in  
> an array ($article_row) which contains a number of elements  
> $article_row[title] etc I have been looking to see if there is  
> syntax to store the entire array in memcache so that once brought  
> out the array can be manipulated (as it is currently) and displayed  
> as required.
Have you actually tried it? Just stuff an array into it and you'll  
get it back, just like any other var. I think it has much the same  
constraints as sessions in PHP in that if you store an object, you  
need to have its class loaded when it gets unserialised (or have an  
__autoload() defined). In my expoerience you don't need to do any  
serialise/unserialise yourself, it's all automatic (and should of  
course play to PHP's magic __sleep() and __wakeup() functions).

Marcus Bointon
Synchromedia Limited: Creators of
marcus at |

More information about the memcached mailing list