NullValue instance should be unwrapped in RedissonCache.get method. #853

pull/856/head
Nikita 8 years ago
parent 9e0d445ee9
commit bebbe604e1

@ -26,6 +26,11 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
/**
*
* @author Nikita Koksharov
*
*/
public class CacheConfigSupport {
ObjectMapper jsonMapper = new ObjectMapper();

@ -17,6 +17,11 @@ package org.redisson.spring.cache;
import org.springframework.cache.Cache.ValueWrapper;
/**
*
* @author Nikita Koksharov
*
*/
public class NullValue implements ValueWrapper {
public static final NullValue INSTANCE = new NullValue();

@ -87,7 +87,7 @@ public class RedissonCache implements Cache {
throw new IllegalStateException("Cached value is not of required type [" + type.getName() + "]: " + value);
}
}
return (T) value;
return (T) fromStoreValue(value);
}
@Override
@ -165,7 +165,7 @@ public class RedissonCache implements Cache {
}
protected Object fromStoreValue(Object storeValue) {
if (storeValue == NullValue.INSTANCE) {
if (storeValue.getClass() == NullValue.class) {
return null;
}
return storeValue;

Loading…
Cancel
Save