File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
core/decision_service/cmab Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ import murmurhash from "murmurhash";
2525import { DecideOptionsMap } from ".." ;
2626import { SerialRunner } from "../../../utils/executor/serial_runner" ;
2727import {
28- CMAB_CACHE_ATTRIBUTES_MISMATCH ,
28+ CMAB_CACHE_HIT ,
29+ CMAB_CACHE_MISS ,
2930 IGNORE_CMAB_CACHE ,
3031 INVALIDATE_CMAB_CACHE ,
3132 RESET_CMAB_CACHE ,
@@ -66,6 +67,7 @@ export type CmabServiceOptions = {
6667
6768const SERIALIZER_BUCKETS = 1000 ;
6869const LOGGER_NAME = 'CmabService' ;
70+
6971export class DefaultCmabService implements CmabService {
7072 private cmabCache : CacheWithRemove < CmabCacheValue > ;
7173 private cmabClient : CmabClient ;
@@ -132,9 +134,10 @@ export class DefaultCmabService implements CmabService {
132134
133135 if ( cachedValue ) {
134136 if ( cachedValue . attributesHash === attributesHash ) {
137+ this . logger ?. debug ( CMAB_CACHE_HIT , userId , ruleId ) ;
135138 return { variationId : cachedValue . variationId , cmabUuid : cachedValue . cmabUuid } ;
136139 } else {
137- this . logger ?. debug ( CMAB_CACHE_ATTRIBUTES_MISMATCH , userId , ruleId ) ;
140+ this . logger ?. debug ( CMAB_CACHE_MISS , userId , ruleId ) ;
138141 this . cmabCache . remove ( cacheKey ) ;
139142 }
140143 }
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export const EVENT_STORE_FULL = 'Event store is full. Not saving event with id %
6464export const IGNORE_CMAB_CACHE = 'Ignoring CMAB cache for user %s and rule %s.' ;
6565export const RESET_CMAB_CACHE = 'Resetting CMAB cache for user %s and rule %s.' ;
6666export const INVALIDATE_CMAB_CACHE = 'Invalidating CMAB cache for user %s and rule %s.' ;
67- export const CMAB_CACHE_ATTRIBUTES_MISMATCH = 'CMAB cache attributes mismatch for user %s and rule %s, fetching new decision.' ;
67+ export const CMAB_CACHE_HIT = 'Cache hit for user %s and rule %s.' ;
68+ export const CMAB_CACHE_MISS = 'Cache miss for user %s and rule %s.' ;
6869
6970export const messages : string [ ] = [ ] ;
You can’t perform that action at this time.
0 commit comments