memcached expiring before time
I am trying to use Memcached to cache all multi-language strings, instead of using a big array for all PHP pages.
What I do, is to fetch the translated phrases from the database and, in a loop, I set each to memcached:
while (fetching database) {
$memcached->set($language.':'.$string_id, $translation, 0, 0);
}
The problem is, most of them (not all, seems random) are automatically "expired" after, no clue why.
These are my stats:Server's Currently Free Memory: more than 1开发者_如何学PythonGB
Total Memcached Space: 16MB Currently Memcached used: 2.66MBThe "evictions" stats (removed items to free memory for new items) increase allot when I run the cycle. This makes no much sense to me, because I am setting to never expire and memcached has lots of free space, still.
Does anyone know what may be happening?
Thank you.0 isn't 30 days, it's 0 (i.e. do not expire).
16MB isn't enough to work with. You're blowing one of your slabs very quickly and trying to store data into another one and not having any space for it.
If you really want this to fit within 16MB, you can adjust the slabs to have them be a fixed size. Probably far easier just to give it enough ram to work with your varied data sizes.
精彩评论