You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to configure hibernate second level and spring cache the same redissonclient?
My solution is access redissonClient after initialized SingletonRedisRegionFactory, than construct RedissonSpringCacheManager with redissonClient;
it can Programaticly like below (2 class)
public class XRedisFactory extends SingletonRedisRegionFactory {
private static RedissonClient redissonClient = null;
public CMRedisFactory(Properties props) {
super(props);
}
public void start(SessionFactoryOptions options, Properties properties) throws CacheException {
super.start(options, properties);
redissonClient = super.redis.getRedisson();
}
public static RedissonClient getRedissonClient() {
return redissonClient;
}
}
public class XRedisClient extends RedissonSpringCacheManager {
public XRedisClient() {
super(XRedisFactory.getRedissonClient());
}
}
is there any efficient way ? (whithout code)
The text was updated successfully, but these errors were encountered:
We had a similar problem, little difference is that we wanted to build a HealthIndicator for the client used in the region factory. We ended up creating a whole new client using the same Config object as the RegionFactory just to check the status.
I'm planning on opening a PR to fix it. Maybe using final RedisCacheUtil class to store a reference to the client?
How to configure hibernate second level and spring cache the same redissonclient?
My solution is access redissonClient after initialized SingletonRedisRegionFactory, than construct RedissonSpringCacheManager with redissonClient;
it can Programaticly like below (2 class)
public class XRedisFactory extends SingletonRedisRegionFactory {
private static RedissonClient redissonClient = null;
public CMRedisFactory(Properties props) {
super(props);
}
public void start(SessionFactoryOptions options, Properties properties) throws CacheException {
super.start(options, properties);
redissonClient = super.redis.getRedisson();
}
public static RedissonClient getRedissonClient() {
return redissonClient;
}
}
public class XRedisClient extends RedissonSpringCacheManager {
public XRedisClient() {
super(XRedisFactory.getRedissonClient());
}
}
is there any efficient way ? (whithout code)
The text was updated successfully, but these errors were encountered: