We are using the memcached server for caching the data, when ever we do any changes on configuration files we need to restart memcached server , which leads to the over load on the server.

Is it possible to clear the memcached based on the key value pair or by passing any specific input so that part of the memcached will be cleared.

| improve this question | | | | |

Yes you can do it with one php script with inbuilt function


/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);

/* item will be deleted by the server */
memcache_delete($memcache_obj, 'key_to_delete');

/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);



look for detail http://php.net/manual/en/memcache.delete.php

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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