Просмотр исходного кода

点击缓存redis修改为24小时

yumeng 4 недель назад
Родитель
Сommit
3987791c93

+ 1 - 1
src/main/java/com/adx/tencent/config/AppProperties.java

@@ -125,7 +125,7 @@ public class AppProperties {
     private int redisDb = 0;
     private String redisStream = "adx:tencent:events";
     private long redisStreamMaxLen = 50000;
-    private Duration bidTtl = Duration.ofHours(36);
+    private Duration bidTtl = Duration.ofHours(24);
     private Duration redisConnectTimeout = Duration.ofSeconds(5);
     private Duration redisCommandTimeout = Duration.ofSeconds(5);
     private Duration redisShutdownTimeout = Duration.ofMillis(100);

+ 1 - 1
src/main/java/com/adx/tencent/honor/store/HonorHotStore.java

@@ -157,7 +157,7 @@ public class HonorHotStore {
     }
 
     private Duration resolvedBidTtl() {
-        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(36) : bidTtl;
+        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(24) : bidTtl;
     }
 
     public Map<String, HonorBidRecord> findBidsByQks(List<String> qks) {

+ 1 - 1
src/main/java/com/adx/tencent/httpapi/AdminController.java

@@ -122,7 +122,7 @@ public class AdminController {
         }
         long ttlSeconds = toLong(body == null ? null : body.get("ttlSeconds"));
         if (ttlSeconds <= 0) {
-            ttlSeconds = Duration.ofHours(36).getSeconds();
+            ttlSeconds = Duration.ofHours(24).getSeconds();
         }
         long scanCount = toLong(body == null ? null : body.get("scanCount"));
         if (scanCount <= 0) {

+ 1 - 1
src/main/java/com/adx/tencent/kuaishou/store/KuaishouHotStore.java

@@ -149,7 +149,7 @@ public class KuaishouHotStore {
     }
 
     private Duration resolvedBidTtl() {
-        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(36) : bidTtl;
+        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(24) : bidTtl;
     }
 
     public Map<String, KuaishouBidRecord> findBidsByQks(List<String> qks) {

+ 1 - 1
src/main/java/com/adx/tencent/oppo/store/OppoHotStore.java

@@ -327,7 +327,7 @@ public class OppoHotStore {
     }
 
     private Duration resolvedBidTtl() {
-        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(36) : bidTtl;
+        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(24) : bidTtl;
     }
 
     private OppoBidRecord parseBidRecord(String payload) {

+ 1 - 1
src/main/java/com/adx/tencent/vivo/store/VivoHotStore.java

@@ -166,7 +166,7 @@ public class VivoHotStore {
     }
 
     private Duration resolvedBidTtl() {
-        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(36) : bidTtl;
+        return (bidTtl == null || bidTtl.isZero()) ? Duration.ofHours(24) : bidTtl;
     }
 
     public Map<String, VivoBidRecord> findBidsByQks(List<String> qks) {

+ 1 - 1
src/main/resources/application-prod.yml

@@ -49,7 +49,7 @@ adx:
   redis-username: "hcst"
   redis-password: "hcst@2026qwe.."
   redis-db: 5
-  bid-ttl: 36h
+  bid-ttl: 24h
   redis-connect-timeout: 5s
   redis-command-timeout: 5s
   redis-shutdown-timeout: 100ms

+ 5 - 5
src/test/java/com/adx/tencent/oppo/store/OppoHotStoreTest.java

@@ -53,7 +53,7 @@ class OppoHotStoreTest {
     @SuppressWarnings({"rawtypes", "unchecked"})
     void impressionCachesAreSmallAndExpireInTenMinutesButStreamKeepsFullEvent() throws Exception {
         OppoBidRecord record = record();
-        store(Duration.ofHours(36)).recordBid(record);
+        store(Duration.ofHours(24)).recordBid(record);
         JsonNode hot = cachePayload(Duration.ofMinutes(10));
         assertEquals("click-url", hot.get("clickUrls").get(0).asText());
         assertEquals("store-url", hot.get("appStoreLink").asText());
@@ -99,14 +99,14 @@ class OppoHotStoreTest {
     }
 
     @Test
-    void zeroTtlFallsBackToThirtySixHoursAfterClick() throws Exception {
+    void zeroTtlFallsBackToTwentyFourHoursAfterClick() throws Exception {
         store(Duration.ZERO).shrinkAfterClick(record());
-        cachePayload(Duration.ofHours(36));
+        cachePayload(Duration.ofHours(24));
     }
 
     @Test
     void clickCacheMissDoesNotUseDbRecordWithoutTrackingLinks() {
-        assertNull(store(Duration.ofHours(36)).findBidByMediaTrace("req"));
+        assertNull(store(Duration.ofHours(24)).findBidByMediaTrace("req"));
         verifyNoInteractions(cold);
     }
 
@@ -115,7 +115,7 @@ class OppoHotStoreTest {
         OppoBidRecord record = record();
         when(values.multiGet(List.of("adx:oppo:bid:qk"))).thenReturn(java.util.Collections.singletonList(null));
         when(cold.getBidsByQks(List.of("qk"))).thenReturn(List.of(record));
-        assertSame(record, store(Duration.ofHours(36)).findBidsByQks(List.of("qk")).get("qk"));
+        assertSame(record, store(Duration.ofHours(24)).findBidsByQks(List.of("qk")).get("qk"));
     }
 
     private JsonNode cachePayload(Duration ttl) throws Exception {