0

I have the memcache module installed on Drupal 7. While it works fine I would like to implement some custom caching in some of my modules. For example, if I want to store the array:

$data = array('hi'=>1,'bye'=>2);

I can normally do the following:

$memcache_obj = memcache_connect('memcache_host', 11211);
memcache_set($memcache_obj, 'var_key', $data, 0, 30);

How can I do the equivalent in Drupal using the memcache module. I am trying to avoid having to declare the $memcache_obj each time and just use the one designated by the module.

1 Answer 1

2

With Drupal you are not supposed to manage the cache backend by yourself. Once memcached is set as your cache backend, you can just use the cache functions cache_set(), cache_get(), etc. and this data will go to cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.