|
@@ -122,7 +122,7 @@ public class RedisZSetCaching implements Caching {
|
|
* 缓存升序批量获取脚本
|
|
* 缓存升序批量获取脚本
|
|
*/
|
|
*/
|
|
@SuppressWarnings("rawtypes")
|
|
@SuppressWarnings("rawtypes")
|
|
- private static final RedisScript<List> AES_LIST_SCRIPT = new DefaultRedisScript<>(
|
|
|
|
|
|
+ private static final RedisScript<List> ASC_LIST_SCRIPT = new DefaultRedisScript<>(
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"local ids = redis.call('ZRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local ids = redis.call('ZRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local values = {} for i = 1, #ids do local value = redis.call('GET', KEYS[1]..':'..ids[i]) " +
|
|
"local values = {} for i = 1, #ids do local value = redis.call('GET', KEYS[1]..':'..ids[i]) " +
|
|
@@ -133,7 +133,7 @@ public class RedisZSetCaching implements Caching {
|
|
* 缓存升序批量获取并设置过期时间脚本
|
|
* 缓存升序批量获取并设置过期时间脚本
|
|
*/
|
|
*/
|
|
@SuppressWarnings("rawtypes")
|
|
@SuppressWarnings("rawtypes")
|
|
- private static final RedisScript<List> AES_LIST_DEFER_SCRIPT = new DefaultRedisScript<>(
|
|
|
|
|
|
+ private static final RedisScript<List> ASC_LIST_DEFER_SCRIPT = new DefaultRedisScript<>(
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"local ids = redis.call('ZRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local ids = redis.call('ZRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local values = {} for i = 1, #ids do local unique = KEYS[1]..':'..ids[i] " +
|
|
"local values = {} for i = 1, #ids do local unique = KEYS[1]..':'..ids[i] " +
|
|
@@ -148,7 +148,7 @@ public class RedisZSetCaching implements Caching {
|
|
* 缓存降序批量获取脚本
|
|
* 缓存降序批量获取脚本
|
|
*/
|
|
*/
|
|
@SuppressWarnings("rawtypes")
|
|
@SuppressWarnings("rawtypes")
|
|
- private static final RedisScript<List> DES_LIST_SCRIPT = new DefaultRedisScript<>(
|
|
|
|
|
|
+ private static final RedisScript<List> DESC_LIST_SCRIPT = new DefaultRedisScript<>(
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"local ids = redis.call('ZREVRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local ids = redis.call('ZREVRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local values = {} for i = 1, #ids do local value = redis.call('GET', KEYS[1]..':'..ids[i]) " +
|
|
"local values = {} for i = 1, #ids do local value = redis.call('GET', KEYS[1]..':'..ids[i]) " +
|
|
@@ -159,7 +159,7 @@ public class RedisZSetCaching implements Caching {
|
|
* 缓存降序批量获取并设置过期时间脚本
|
|
* 缓存降序批量获取并设置过期时间脚本
|
|
*/
|
|
*/
|
|
@SuppressWarnings("rawtypes")
|
|
@SuppressWarnings("rawtypes")
|
|
- private static final RedisScript<List> DES_LIST_DEFER_SCRIPT = new DefaultRedisScript<>(
|
|
|
|
|
|
+ private static final RedisScript<List> DESC_LIST_DEFER_SCRIPT = new DefaultRedisScript<>(
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"if redis.call('EXISTS', KEYS[2]) == 0 then return nil end " +
|
|
"local ids = redis.call('ZREVRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local ids = redis.call('ZREVRANGEBYSCORE', KEYS[2], '('..ARGV[1], ARGV[2], 'LIMIT', 0, ARGV[3]) " +
|
|
"local values = {} for i = 1, #ids do local unique = KEYS[1]..':'..ids[i] " +
|
|
"local values = {} for i = 1, #ids do local unique = KEYS[1]..':'..ids[i] " +
|
|
@@ -338,15 +338,15 @@ public class RedisZSetCaching implements Caching {
|
|
try {
|
|
try {
|
|
if (naming.isReversed()) {
|
|
if (naming.isReversed()) {
|
|
if (naming.getDuration() > 0) {
|
|
if (naming.getDuration() > 0) {
|
|
- values = this.template.execute(DES_LIST_DEFER_SCRIPT, keys, max, min, size, naming.getDuration());
|
|
|
|
|
|
+ values = this.template.execute(DESC_LIST_DEFER_SCRIPT, keys, max, min, size, naming.getDuration());
|
|
} else {
|
|
} else {
|
|
- values = this.template.execute(DES_LIST_SCRIPT, keys, max, min, size);
|
|
|
|
|
|
+ values = this.template.execute(DESC_LIST_SCRIPT, keys, max, min, size);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (naming.getDuration() > 0) {
|
|
if (naming.getDuration() > 0) {
|
|
- values = this.template.execute(AES_LIST_DEFER_SCRIPT, keys, min, max, size, naming.getDuration());
|
|
|
|
|
|
+ values = this.template.execute(ASC_LIST_DEFER_SCRIPT, keys, min, max, size, naming.getDuration());
|
|
} else {
|
|
} else {
|
|
- values = this.template.execute(AES_LIST_SCRIPT, keys, min, max, size);
|
|
|
|
|
|
+ values = this.template.execute(ASC_LIST_SCRIPT, keys, min, max, size);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable t) {
|
|
} catch (Throwable t) {
|