Skip to content

Commit

Permalink
Add test for unsharing object.
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Tianjie <[email protected]>
  • Loading branch information
CharlesChen888 committed May 6, 2024
1 parent 7f4c421 commit d78870d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/maxmemory.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ start_server {tags {"maxmemory external:skip"}} {
r config set maxmemory 0
}

test "Shared integers are unshared with maxmemory and LRU policy" {
r set a 1
r set b 1
assert_refcount_morethan a 1
assert_refcount_morethan b 1
r config set maxmemory 1073741824
r config set maxmemory-policy allkeys-lru
r get a
assert_refcount 1 a
r config set maxmemory-policy volatile-lru
r get b
assert_refcount 1 b
r config set maxmemory 0
}

foreach policy {
allkeys-random allkeys-lru allkeys-lfu volatile-lru volatile-lfu volatile-random volatile-ttl
} {
Expand Down

0 comments on commit d78870d

Please sign in to comment.