redis-共享对象池

当数据为0–9999的整数时 ,默使用对象池。
可以通过 object refcount 查看对象引用数。

127.0.0.1:6379> set intx 5
OK
127.0.0.1:6379> object refcount intx #直接使用共享对象池内的整数对象。引用数是2。否则为1。
(integer) 2
127.0.0.1:6379> set intxx 5  #引用数+1
OK
127.0.0.1:6379> object refcount intx
(integer) 3
127.0.0.1:6379> object refcount intxx
(integer) 3

注意,当设置maxmemory【1】并启动LUR相关淘汰策略【2】,对象池无效,通过object refcount 查看其引用数会是1

posted @ 2018-10-29 16:15  thewindkee  阅读(554)  评论(0编辑  收藏  举报