From 549d4cd977f687d436feb4a794fd2f784c28250d Mon Sep 17 00:00:00 2001 From: ruicav Date: Wed, 24 Feb 2016 23:06:04 -0300 Subject: [PATCH] persist returns false if key does not exist --- src/main/java/com/fiftyonred/mock_jedis/MockStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java b/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java index e3d5ad4..701937b 100644 --- a/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java +++ b/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java @@ -232,7 +232,7 @@ public synchronized long pttl(final DataContainer key) { public synchronized boolean persist(final DataContainer key) { final KeyInformation info = keys.get(key); - if (info.getTTL() == -1) { + if (info == null || info.getTTL() == -1) { return false; } info.setExpiration(-1L);