X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f2da3a620ce7d9462613a93c07022bb805eb5c90..1609a1c42d8f49bada5375a8756a2ca56609ece8:/src/redis.c?ds=sidebyside diff --git a/src/redis.c b/src/redis.c index b28d717c..36b7c853 100644 --- a/src/redis.c +++ b/src/redis.c @@ -620,11 +620,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { /* Remove a few cached objects from memory if we are over the * configured memory limit */ - while (server.ds_enabled && zmalloc_used_memory() > - server.cache_max_memory) - { - if (cacheFreeOneEntry() == REDIS_ERR) break; - } + if (server.ds_enabled) cacheCron(); /* Replication cron function -- used to reconnect to master and * to detect transfer failures. */ @@ -830,6 +826,9 @@ void initServer() { server.slaves = listCreate(); server.monitors = listCreate(); server.unblocked_clients = listCreate(); + server.cache_flush_queue = listCreate(); + server.cache_flush_delay = 0; + createSharedObjects(); server.el = aeCreateEventLoop(); server.db = zmalloc(sizeof(redisDb)*server.dbnum); @@ -1051,7 +1050,9 @@ int prepareForShutdown() { kill(server.bgsavechildpid,SIGKILL); rdbRemoveTempFile(server.bgsavechildpid); } - if (server.appendonly) { + if (server.ds_enabled) { + /* FIXME: flush all objects on disk */ + } else if (server.appendonly) { /* Append only file: fsync() the AOF and exit */ aof_fsync(server.appendfd); } else if (server.saveparamslen > 0) { @@ -1494,7 +1495,9 @@ int main(int argc, char **argv) { linuxOvercommitMemoryWarning(); #endif start = time(NULL); - if (server.appendonly) { + if (server.ds_enabled) { + redisLog(REDIS_NOTICE,"DB not loaded (running with disk back end)"); + } else if (server.appendonly) { if (loadAppendOnlyFile(server.appendfilename) == REDIS_OK) redisLog(REDIS_NOTICE,"DB loaded from append only file: %ld seconds",time(NULL)-start); } else {