HI,

Is there any alternative in memcached ? or can we write a custom function 
for that ? i need a help please suggest me.

will below function work:

function getMemcacheKeys() {
    $memcache = new Memcache;
    $memcache->connect('127.0.0.1', 11211) 
       or die ("Could not connect to memcache server");

    $list = array();
    $allSlabs = $memcache->getExtendedStats('slabs');
    $items = $memcache->getExtendedStats('items');
    foreach($allSlabs as $server => $slabs) {
        foreach($slabs AS $slabId => $slabMeta) {
            $cdump = $memcache->getExtendedStats('cachedump',(int)$slabId);
            foreach($cdump AS $keys => $arrVal) {
                if (!is_array($arrVal)) continue;
                foreach($arrVal AS $k => $v) {                   
                    echo $k .'<br>';
                }
            }
        }
    }   
} 


Thanks

On Friday, 6 July 2012 13:38:42 UTC+5:30, Dormando wrote:
>
> > 
> > 1.       How would you port the redis command “KEYS *” to memcached? 
> > 
> > [Assume that this will be used for a very large number of keys in a 
> production environment. Please justify your answers and explain how they 
> meet the stated needs.] 
> > 
>
> Your phrasing sounds like you're reading from a college exam. 
>
> No, we don't have a command quite that idiotic.

Reply via email to