M
M
Michael2011-03-24 11:04:51
PHP
Michael, 2011-03-24 11:04:51

Memcached advice needed

There is a memcached server, it stores a lot of records that require quick access to them. But a lot of records expire quickly enough. And as I understand it, the Server does not release the resources occupied by the recording, but only stops giving them away.

Since most keys are unique and automatically generated, doing delete is very problematic.

The question is whether there is some tool, script, third-party program, some client that will help free up resources.

I tried to use the code

  1. $list = array();
  2.   $allSlabs = $m->getExtendedStats('slabs');
  3.   $items = $m->getExtendedStats('items');
  4.   foreach($allSlabs as $server => $slabs){
  5.     foreach($slabs AS $slabId => $slabMeta){
  6.       $cdump = $m->getExtendedStats('cachedump',(int)$slabId);
  7.       foreach($cdump AS $keys => $arrVal){
  8.         foreach($arrVal AS $k => $v){
  9.            $list[$k] = array(
  10.                  'key' => $k,
  11.                  'server' => $server,
  12.                  'slabId' => $slabId,
  13.                  'detail' => $v,
  14.                  'age' => $items[$server]['items'][$slabId]['age']
  15.                  );
  16.         }
  17.       }
  18.     }
  19.   }
* This source code was highlighted with Source Code Highlighter.


In order to get a list of keys on the server, but it does not return already expired keys, please tell me if there is a way to free up resources or I do not understand something

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
homm, 2011-03-24
@homm

How do you judge unfreed resources? The amount of memory occupied does not decrease?
When I screwed the cache to my project, I found that Memkesh, in principle, eats memory not in proportion to the stored data. Refused in favor of Redis. But here you need to look individually. In Redis, there is no preemption when a certain limit is overflowed, only by timeout, so it will not work for everyone.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question