summaryrefslogtreecommitdiff
path: root/src/rdb.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-03-15 13:15:46 +0100
committerantirez <antirez@gmail.com>2018-03-15 13:15:55 +0100
commitd7a5c0eb71c7f1a4ea55460cc585d47f88bdac8c (patch)
tree15b98f5d0f38fef031594dcc76213e26031887f5 /src/rdb.h
parent66143616153eeeb2067b8960221c30110eb39aae (diff)
downloadredis-d7a5c0eb71c7f1a4ea55460cc585d47f88bdac8c.tar.gz
RDB: Ability to save LFU/LRU info.
This is a big win for caching use cases, since on reloading Redis will still have some idea about what is worth to evict and what not. However this only solves part of the problem because the information is only partially propagated to slaves (on write operations). Reads will not affect slaves LFU and LRU counters, so after a failover the eviction decisions are kinda random until keys start to collect some aging/freq info. However since new slaves are initially populated via RDB file transfer, this means that if we spin up a new slave from a master, and perform an immediate manual failover (for instance in order to upgrade the master), the slave will have eviction informations to use for some time. The LFU/LRU info is persisted only if the maxmemory policy is set to one of the relevant type, even if no actual "maxmemory" memory limit is set.
Diffstat (limited to 'src/rdb.h')
-rw-r--r--src/rdb.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rdb.h b/src/rdb.h
index 2456cfb58..321c9a89a 100644
--- a/src/rdb.h
+++ b/src/rdb.h
@@ -97,12 +97,14 @@
#define rdbIsObjectType(t) ((t >= 0 && t <= 7) || (t >= 9 && t <= 15))
/* Special RDB opcodes (saved/loaded with rdbSaveType/rdbLoadType). */
-#define RDB_OPCODE_AUX 250
-#define RDB_OPCODE_RESIZEDB 251
-#define RDB_OPCODE_EXPIRETIME_MS 252
-#define RDB_OPCODE_EXPIRETIME 253
-#define RDB_OPCODE_SELECTDB 254
-#define RDB_OPCODE_EOF 255
+#define RDB_OPCODE_IDLE 248 /* LRU idle time. */
+#define RDB_OPCODE_FREQ 249 /* LFU frequency. */
+#define RDB_OPCODE_AUX 250 /* RDB aux field. */
+#define RDB_OPCODE_RESIZEDB 251 /* Hash table resize hint. */
+#define RDB_OPCODE_EXPIRETIME_MS 252 /* Expire time in milliseconds. */
+#define RDB_OPCODE_EXPIRETIME 253 /* Old expire time in seconds. */
+#define RDB_OPCODE_SELECTDB 254 /* DB number of the following keys. */
+#define RDB_OPCODE_EOF 255 /* End of the RDB file. */
/* Module serialized values sub opcodes */
#define RDB_MODULE_OPCODE_EOF 0 /* End of module value. */