Java Code Examples for org.springframework.cache.support.NullValue#INSTANCE

The following examples show how to use org.springframework.cache.support.NullValue#INSTANCE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: J2CacheCache.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
@Override
protected Object lookup(Object key) {
    CacheObject cacheObject = cacheChannel.get(j2CacheName, String.valueOf(key));
    if (cacheObject.rawValue() != null && cacheObject.rawValue().getClass().equals(NullObject.class)
        && super.isAllowNullValues()) {
        return NullValue.INSTANCE;
    }
    return cacheObject.getValue();
}
 
Example 2
Source File: J2CacheCache.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
protected Object lookup(Object key) {
	CacheObject cacheObject = cacheChannel.get(j2CacheName, String.valueOf(key), false);
	if(cacheObject.rawValue() != null && cacheObject.rawValue().getClass().equals(NullObject.class) && super.isAllowNullValues()) {
		return NullValue.INSTANCE;
	}
	return cacheObject.getValue();
}
 
Example 3
Source File: J2CacheSpringCacheAdapter.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
protected Object lookup(Object key) {
    Object value = j2Cache.get(name, getKey(key), false).rawValue();
    if (value == null || value.getClass().equals(Object.class)) {
        return null;
    }
    if (value.getClass().equals(NullObject.class)) {
        return NullValue.INSTANCE;
    }
    return value;
}
 
Example 4
Source File: J2CacheCache.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
protected Object lookup(Object key) {
	CacheObject cacheObject = cacheChannel.get(j2CacheName, String.valueOf(key), false);
	if(cacheObject.rawValue() != null && cacheObject.rawValue().getClass().equals(NullObject.class) && super.isAllowNullValues()) {
		return NullValue.INSTANCE;
	}
	return cacheObject.getValue();
}