diff options
author | antirez <antirez@gmail.com> | 2014-07-18 10:55:08 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-07-18 10:55:08 +0200 |
commit | 420584a46d757f22525682ecbb9e41b7b410d03a (patch) | |
tree | ee6bbcc653a0e728c3587eae26a081ea7eeab69d | |
parent | 6b9b958e00c8a0eff64af255f790ee5bea40f197 (diff) | |
download | redis-420584a46d757f22525682ecbb9e41b7b410d03a.tar.gz |
Test: small integer sharing depends on maxmemory policy.
-rw-r--r-- | tests/unit/maxmemory.tcl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/maxmemory.tcl b/tests/unit/maxmemory.tcl index 2cde1d830..1431a2ac7 100644 --- a/tests/unit/maxmemory.tcl +++ b/tests/unit/maxmemory.tcl @@ -1,4 +1,28 @@ start_server {tags {"maxmemory"}} { + test "Without maxmemory small integers are shared" { + r config set maxmemory 0 + r set a 1 + assert {[r object refcount a] > 1} + } + + test "With maxmemory and non-LRU policy integers are still shared" { + r config set maxmemory 1073741824 + r config set maxmemory-policy allkeys-random + r set a 1 + assert {[r object refcount a] > 1} + } + + test "With maxmemory and LRU policy integers are not shared" { + r config set maxmemory 1073741824 + r config set maxmemory-policy allkeys-lru + r set a 1 + r config set maxmemory-policy volatile-lru + r set b 1 + assert {[r object refcount a] == 1} + assert {[r object refcount b] == 1} + r config set maxmemory 0 + } + foreach policy { allkeys-random allkeys-lru volatile-lru volatile-random volatile-ttl } { |