
com.github.bingoohuang.springrediscache.RedisCacheConnector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-redis-cache Show documentation
Show all versions of spring-redis-cache Show documentation
spring cache based on redis
The newest version!
package com.github.bingoohuang.springrediscache;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import java.util.concurrent.Callable;
public class RedisCacheConnector {
static ThreadLocal> threadLocal = new ThreadLocal>();
public static T connectCache(Callable callable, Object cachedValue) {
threadLocal.set(Optional.fromNullable(cachedValue));
try {
return callable.call();
} catch (Exception e) {
throw Throwables.propagate(e);
} finally {
threadLocal.remove();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy