ads-redis-key-inventory.md 1.7 KB

Ads Redis Key Inventory

Key pattern Writer(s) Reader(s) Value type TTL Notes
box:app:adpool:{adType} AdPoolService.rebuildPoolForType (via CacheSyncService.rebuildAdsCacheByType/warm cache) readAdPoolEntriesWithLegacySupport → used by AdService.getAdForPlacement and HomepageService.getAdsByType JSON array of AdPoolEntry none Canonical pool keyed by AdType. Writers select [id,adType,advertiser,title,adsContent,adsCoverImg,adsUrl,imgSource,startDt,expiryDt,seq] and preserve seq-ascending order. Legacy module-keyed pool is rehydrated once and deleted after a warm rebuild.
app:adpool:{adsModuleId} None (legacy) readAdPoolEntriesWithLegacySupport (fallback path that looks up AdsModule by adType) JSON array (legacy schema) none Transitional key used only when the new box:app:adpool pool is missing. The helper logs a warning, writes the normalized entries into the adType pool, and never falls back again.
app:ad:by-id:{adId} CacheSyncService.rebuildSingleAdCache (triggered by AdsService.scheduleAdRefresh) AdService.fetchAdDetails (placement), HomepageService.fetchAdDetails JSON object (per-ad payload: id,advertiser,title,adsContent,adsCoverImg,adsUrl,imgSource,adType,startDt,expiryDt,seq) ~300s (CacheSyncService.AD_CACHE_TTL) Per-ad cache entry with short TTL to keep metadata fresh. Writers delete the key when the ad is inactive or missing.

No Ads keys currently live without writers/readers except for the legacy app:adpool:{adsModuleId} fallback. The canonical box:app:adpool:{adType} should remain the single source of truth once caches rebuild and the legacy key is pruned.