| 232 | * right. */ |
| 233 | |
| 234 | int evictionPoolPopulate(int dbid, redisDb *db, bool fVolatile, struct evictionPoolEntry *pool) |
| 235 | { |
| 236 | int returnCount = 0; |
| 237 | dictEntry **samples = (dictEntry**)alloca(g_pserver->maxmemory_samples * sizeof(dictEntry*)); |
| 238 | int count = dictGetSomeKeys(db->dictUnsafeKeyOnly(),samples,g_pserver->maxmemory_samples); |
| 239 | for (int j = 0; j < count; j++) { |
| 240 | robj *o = (robj*)dictGetVal(samples[j]); |
| 241 | // If the object is in second tier storage we don't need to evict it (since it already is) |
| 242 | if (o != nullptr) |
| 243 | { |
| 244 | if (!fVolatile || o->FExpires()) { |
| 245 | processEvictionCandidate(dbid, (sds)dictGetKey(samples[j]), o, &o->expire, pool); |
| 246 | ++returnCount; |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | return returnCount; |
| 251 | } |
| 252 | |
| 253 | /* ---------------------------------------------------------------------------- |
| 254 | * LFU (Least Frequently Used) implementation. |
no test coverage detected