Example usage for org.springframework.cache.support SimpleValueWrapper SimpleValueWrapper

List of usage examples for org.springframework.cache.support SimpleValueWrapper SimpleValueWrapper

Introduction

In this page you can find the example usage for org.springframework.cache.support SimpleValueWrapper SimpleValueWrapper.

Prototype

public SimpleValueWrapper(@Nullable Object value) 

Source Link

Document

Create a new SimpleValueWrapper instance for exposing the given value.

Usage

From source file:org.springframework.data.redis.cache.RedisCache.java

public ValueWrapper get(final Object key) {
    return (ValueWrapper) template.execute(new RedisCallback<ValueWrapper>() {

        public ValueWrapper doInRedis(RedisConnection connection) throws DataAccessException {
            waitForLock(connection);//from   w  ww.  j  a  v  a2 s .c  o m
            byte[] bs = connection.get(computeKey(key));
            Object value = template.getValueSerializer() != null ? template.getValueSerializer().deserialize(bs)
                    : bs;
            return (bs == null ? null : new SimpleValueWrapper(value));
        }
    }, true);
}

From source file:org.springframework.data.redis.cache.RedisCache.java

private ValueWrapper toWrapper(Object value) {
    return (value != null ? new SimpleValueWrapper(value) : null);
}