Skip to content

Commit 6db0e43

Browse files
committed
fix: still set duplicate redis values to prevent them from expiring early
1 parent c9cd864 commit 6db0e43

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

core/src/main/java/net/staticstudios/data/impl/h2/H2DataAccessor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,7 @@ public void postDDL() throws SQLException {
561561
@Override
562562
public void setRedisValue(String holderSchema, String holderTable, String identifier, ColumnValuePairs idColumns, String value, int expirationSeconds, int delay) {
563563
String prev = getAndSetRedisValueCache(holderSchema, holderTable, identifier, idColumns, value);
564-
if (Objects.equals(prev, value)) {
565-
return; // no change
566-
}
564+
//note: even if the prev value = the new value we need to update redis since we want to reset the expiration time if one is present
567565
String key = RedisUtils.buildRedisKey(holderSchema, holderTable, identifier, idColumns);
568566

569567
Runnable runnable = () -> {
@@ -595,6 +593,10 @@ public void setRedisValue(String holderSchema, String holderTable, String identi
595593
}
596594
}
597595

596+
if (Objects.equals(prev, value)) {
597+
return; // no need to call handlers if the value didn't actually change
598+
}
599+
598600
RedisUtils.DeconstructedKey deconstructedKey = RedisUtils.deconstruct(key);
599601
dataManager.callCachedValueUpdateHandlers(deconstructedKey.partialKey(), deconstructedKey.encodedIdNames(), deconstructedKey.encodedIdValues(), prev, value);
600602
}

0 commit comments

Comments
 (0)