Can you store an Array in Memcache?
I would like to store;
Together as an array, someone told me you could and then someone told me you couldn't Which is it?
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached puts often-used data in RAM, allowing it to be accessed a lot faster. Caching with Memcached works like this: A web browser requests a page, and the server runs PHP code to build it. PHP asks Memcached for the page's data via a Memcached extension.
To enable the PHP memcache extensions, build PHP using the --enable-memcache option to configure when building from source. On Debian-based distributions, use the php-memcache package. To set global runtime configuration options, specify the configuration option values within your php. ini file.
Yes.
Memcache::set('someKey', array(
'user_id' => 1,
'url' => 'http://',
'name' => 'Dave'
));
Please see the documentation for very detailed examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With