Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
55cf8433
Commit
55cf8433
authored
Jan 05, 2010
by
antirez
Browse files
load key from swap on key lookup
parent
a35ddf12
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
55cf8433
...
...
@@ -488,6 +488,7 @@ static void unblockClient(redisClient *c);
static int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele);
static void vmInit(void);
static void vmMarkPagesFree(off_t page, off_t count);
static robj *vmLoadObject(robj *key);
static void authCommand(redisClient *c);
static void pingCommand(redisClient *c);
...
...
@@ -2359,11 +2360,21 @@ static void decrRefCount(void *obj) {
static robj *lookupKey(redisDb *db, robj *key) {
dictEntry *de = dictFind(db->dict,key);
if (de) {
robj *o = dictGetEntryVal(de);
robj *key = dictGetEntryKey(de);
robj *val = dictGetEntryVal(de);
/* Update the access time of the key for the aging algorithm. */
if (server.vm_enabled) o->vm.atime = server.unixtime;
return o;
if (server.vm_enabled) {
if (key->storage == REDIS_VM_MEMORY) {
/* Update the access time of the key for the aging algorithm. */
key->vm.atime = server.unixtime;
} else {
/* Our value was swapped on disk. Bring it at home. */
assert(val == NULL);
val = vmLoadObject(key);
dictGetEntryVal(de) = val;
}
}
return val;
} else {
return NULL;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment