Fixed - Hibernate region_prefix configuration doesn't apply to redis key redisson-hibernate-timestamp

Signed-off-by: seakider <seakider@gmail.com>
pull/6474/head
seakider 7 days ago
parent 9141c12690
commit 90f582e465

@ -19,7 +19,6 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.*; import org.hibernate.cache.spi.*;
import org.hibernate.cache.spi.access.AccessType; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.redisson.Redisson; import org.redisson.Redisson;
@ -169,7 +168,7 @@ public class RedissonRegionFactory implements RegionFactory {
+ "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); " + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
+ "redis.call('set', KEYS[1], nextValue); " + "redis.call('set', KEYS[1], nextValue); "
+ "return nextValue;", + "return nextValue;",
RScript.ReturnType.INTEGER, Collections.singletonList(qualifyName("redisson-hibernate-timestamp")), time); RScript.ReturnType.INTEGER, Collections.singletonList("redisson-hibernate-timestamp"), time);
} catch (Exception e) { } catch (Exception e) {
if (fallback) { if (fallback) {
while (true) { while (true) {
@ -190,14 +189,6 @@ public class RedissonRegionFactory implements RegionFactory {
} }
} }
private String qualifyName(String name) {
String prefix = settings.getCacheRegionPrefix();
if (StringHelper.isEmpty(prefix)) {
return name;
}
return prefix + "." + name;
}
@Override @Override
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
throws CacheException { throws CacheException {

@ -22,7 +22,6 @@ import org.hibernate.cache.spi.*;
import org.hibernate.cache.spi.access.AccessType; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.redisson.Redisson; import org.redisson.Redisson;
@ -176,7 +175,7 @@ import java.util.concurrent.atomic.AtomicLong;
+ "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); " + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
+ "redis.call('set', KEYS[1], nextValue); " + "redis.call('set', KEYS[1], nextValue); "
+ "return nextValue;", + "return nextValue;",
RScript.ReturnType.INTEGER, Collections.singletonList(qualifyName("redisson-hibernate-timestamp")), time); RScript.ReturnType.INTEGER, Collections.singletonList("redisson-hibernate-timestamp"), time);
} catch (Exception e) { } catch (Exception e) {
if (fallback) { if (fallback) {
while (true) { while (true) {
@ -197,14 +196,6 @@ import java.util.concurrent.atomic.AtomicLong;
} }
} }
private String qualifyName(String name) {
String prefix = settings.getCacheRegionPrefix();
if (StringHelper.isEmpty(prefix)) {
return name;
}
return prefix + "." + name;
}
@Override @Override
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
throws CacheException { throws CacheException {

@ -22,7 +22,6 @@ import org.hibernate.cache.spi.*;
import org.hibernate.cache.spi.access.AccessType; import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.redisson.Redisson; import org.redisson.Redisson;
@ -177,7 +176,7 @@ public class RedissonRegionFactory implements RegionFactory {
+ "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); " + "local nextValue = math.max(tonumber(ARGV[1]), tonumber(currentTime) + 1); "
+ "redis.call('set', KEYS[1], nextValue); " + "redis.call('set', KEYS[1], nextValue); "
+ "return nextValue;", + "return nextValue;",
RScript.ReturnType.INTEGER, Collections.singletonList(qualifyName("redisson-hibernate-timestamp")), time); RScript.ReturnType.INTEGER, Collections.singletonList("redisson-hibernate-timestamp"), time);
} catch (Exception e) { } catch (Exception e) {
if (fallback) { if (fallback) {
while (true) { while (true) {
@ -198,14 +197,6 @@ public class RedissonRegionFactory implements RegionFactory {
} }
} }
private String qualifyName(String name) {
String prefix = settings.getCacheRegionPrefix();
if (StringHelper.isEmpty(prefix)) {
return name;
}
return prefix + "." + name;
}
@Override @Override
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
throws CacheException { throws CacheException {

Loading…
Cancel
Save