DATAREDIS-510 - Fix caching of null values.

We now no longer add empty byte[] as cache value but return null instead.

Original pull request: #201.
This commit is contained in:
Christoph Strobl
2016-06-14 14:42:31 +02:00
committed by Mark Paluch
parent 28b5d61029
commit 67106bc75a
2 changed files with 40 additions and 3 deletions

View File

@@ -686,10 +686,14 @@ public class RedisCache implements Cache {
connection.multi();
}
connection.set(element.getKeyBytes(), element.get());
if (element.get().length == 0) {
connection.del(element.getKeyBytes());
} else {
connection.set(element.getKeyBytes(), element.get());
processKeyExpiration(element, connection);
maintainKnownKeys(element, connection);
processKeyExpiration(element, connection);
maintainKnownKeys(element, connection);
}
if (!isClusterConnection(connection)) {
connection.exec();