Skip to content

Commit eb6f90f

Browse files
@initial 7.0.0-preview.604 Fixup redis cache bugs
1 parent bb31d49 commit eb6f90f

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/main/java/com/talexframe/frame/core/modules/network/connection/RequestAnalyser.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.lang.reflect.Method;
3333
import java.lang.reflect.Parameter;
3434
import java.nio.charset.StandardCharsets;
35+
import java.time.Duration;
3536
import java.util.*;
3637

3738
/**
@@ -497,7 +498,7 @@ private String getRedisCacheKey( List<Object> params ) {
497498

498499
if ( key.startsWith("#params") ) {
499500

500-
int index = Integer.parseInt(key.substring(7, 8));
501+
int index = Integer.parseInt(key.substring(8, 9));
501502

502503
if ( index + 1 > params.size() ) {
503504

@@ -506,12 +507,12 @@ private String getRedisCacheKey( List<Object> params ) {
506507
}
507508

508509
Object obj = params.get(index);
509-
String value = null;
510+
String value = (String) obj;
510511
JSONObject json1 = new JSONObject().putOpt("data", obj);
511512

512513
if ( key.contains("].") ) {
513514

514-
String[] args = key.split(".");
515+
String[] args = key.split("\\.");
515516

516517
for ( int i = 1; i < args.length; ++i ) {
517518

@@ -532,10 +533,10 @@ private String getRedisCacheKey( List<Object> params ) {
532533

533534
}
534535

535-
key = value;
536-
537536
}
538537

538+
key = value;
539+
539540
}
540541

541542
// if ( key.startsWith("#data") ) {
@@ -583,7 +584,7 @@ private String getRedisCacheKey( List<Object> params ) {
583584

584585
}
585586

586-
return key;
587+
return tRedisCache.type() + "_" + key;
587588

588589
}
589590

@@ -615,7 +616,7 @@ public void processRedisCache(List<Object> params, Object data) {
615616

616617
if ( tRedisCache.expireTime() > 0 ) {
617618

618-
vo.set(key, cacheValue, tRedisCache.expireTime());
619+
vo.set(key, cacheValue, Duration.ofSeconds(tRedisCache.expireTime()));
619620

620621
} else {
621622

0 commit comments

Comments
 (0)