Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
A well-placed cache is the cheapest way to buy speed. A misplaced cache is the most expensive way to buy bugs.
StrategyHow It WorksWhen to UseCache-Aside (Lazy)App checks cache β miss β reads DB β writes to cacheDefault choice β general purposeRead-ThroughCache fetches from DB on miss automaticallyORM-integrated caching, CDN origin fetchWrite-ThroughWrites go to cache AND DB synchronouslyRead-heavy with strong consistencyWrite-BehindWrites go to cache, async flush to DBHigh write throughput, eventual consistency OKRefresh-AheadCache proactively refreshes before expiryPredictable access patterns, low-latency critical Cache-Aside Flow: App βββΊ Cache βββΊ HIT? βββΊ Return data β βΌ MISS Read DB βββΊ Store in Cache βββΊ Return data
MethodConsistencyWhen to UseTTL-basedEventual (up to TTL)Simple data, acceptable stalenessEvent-basedStrong (near real-time)Inventory, profile updatesVersion-basedStrongStatic assets, API responses, configTag-basedStrongCMS content, category-based purging
Data TypeTTLRationaleStatic assets (CSS/JS/images)1 year + cache-busting hashImmutable by filenameAPI config / feature flags30β60 secondsFast propagation neededUser profile data5β15 minutesTolerable stalenessProduct catalog1β5 minutesBalance freshness vs loadSession dataMatch session timeoutSecurity requirement
DirectiveMeaningmax-age=NCache for N secondss-maxage=NCDN/shared cache max age (overrides max-age)no-cacheMust revalidate before using cached copyno-storeNever cache anywheremust-revalidateOnce stale, must revalidateprivateOnly browser can cache, not CDNpublicAny cache can storeimmutableContent will never change (within max-age)stale-while-revalidate=NServe stale for N seconds while fetching fresh
# Immutable static assets (hashed filenames) Cache-Control: public, max-age=31536000, immutable # API response, CDN-cached, background refresh Cache-Control: public, s-maxage=60, stale-while-revalidate=300 # Personalized data, browser-only Cache-Control: private, max-age=0, must-revalidate ETag: "abc123" # Never cache (auth tokens, sensitive data) Cache-Control: no-store
MechanismRequest HeaderResponse HeaderHow It WorksETagIf-None-Match: "abc"ETag: "abc"Hash-based β 304 if matchLast-ModifiedIf-Modified-Since: <date>Last-Modified: <date>Date-based β 304 if unchanged Prefer ETag over Last-Modified β ETags detect content changes regardless of timestamp granularity.
SolutionSpeedShared Across ProcessesWhen to UseIn-memory LRUFastestNoSingle-process, bounded memory, hot dataRedisSub-ms (network)YesProduction default β TTL, pub/sub, persistenceMemcachedSub-ms (network)YesSimple key-value at extreme scaleSQLiteFast (disk)NoEmbedded apps, edge caching
FeatureRedisMemcachedData structuresStrings, hashes, lists, sets, sorted setsStrings onlyPersistenceAOF, RDB snapshotsNonePub/SubYesNoMax value size512 MB1 MBVerdictDefault choicePure cache at extreme scale
ConcernSolutionPartitioningConsistent hashing β minimal reshuffling on node changesReplicationPrimary-replica β writes to primary, reads from replicasFailoverRedis Sentinel or Cluster auto-failover Rule of thumb: 3 primaries + 3 replicas minimum for production Redis Cluster.
PolicyHow It WorksWhen to UseLRUEvicts least recently accessedDefault β general purposeLFUEvicts least frequently accessedSkewed popularity distributionsFIFOEvicts oldest entrySimple, time-ordered dataTTLEvicts after fixed durationData with known freshness window Redis default is noeviction. Set maxmemory-policy to allkeys-lru or volatile-lru for production.
Browser Cache β CDN β Load Balancer β App Cache β DB Cache β Database LayerWhat to CacheInvalidationBrowserStatic assets, API responsesVersioned URLs, Cache-ControlCDNStatic files, public API responsesPurge API, surrogate keysApplicationComputed results, DB queries, external APIEvent-driven, TTLDatabaseQuery plans, buffer pool, materialized viewsANALYZE, manual refresh
When a hot key expires, hundreds of requests simultaneously hit the database. TechniqueHow It WorksMutex / LockFirst request locks, fetches, populates; others waitProbabilistic early expirationRandom chance of refreshing before TTLRequest coalescingDeduplicate in-flight requests for same keyStale-while-revalidateServe stale, refresh asynchronously
StrategyWhen to UseOn-deploy warm-upPredictable key set, latency-sensitiveBackground jobReports, dashboards, catalog dataShadow trafficCache migration, new infrastructurePriority-basedLimited warm-up time budget Cold start impact: A full cache flush can increase DB load 10β100x. Always warm gradually or use stale-while-revalidate.
MetricHealthy RangeAction if UnhealthyHit rate> 90%Low β cache too small, wrong TTL, bad key designEviction rateNear 0 steady stateHigh β increase memory or tune policyLatency (p99)< 1ms (Redis)High β network issue, large values, hot keyMemory usage< 80% of maxApproaching max β scale up or tune eviction
NEVER cache without a TTL or invalidation plan β data rots; every entry needs an expiry path NEVER treat cache as durable storage β caches evict, crash, and restart; always fall back to source of truth NEVER cache sensitive data (tokens, PII) without encryption β cache breaches expose everything in plaintext NEVER ignore cache stampede on hot keys β one expired popular key can take down your database NEVER use unbounded in-memory caches in production β memory grows until OOM-killed NEVER cache mutable data with immutable Cache-Control β browsers will never re-fetch NEVER skip monitoring hit/miss rates β you won't know if your cache is helping or hurting
Agent frameworks, memory systems, reasoning layers, and model-native orchestration.
Largest current source with strong distribution and engagement signals.