← All skills
Tencent SkillHub Β· AI

caching

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.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

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.

⬇ 0 downloads β˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
README.md, SKILL.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

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.

Upgrade existing

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.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 16 sections Open source page

Caching Patterns

A well-placed cache is the cheapest way to buy speed. A misplaced cache is the most expensive way to buy bugs.

Cache Strategies

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

Cache Invalidation

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

TTL Guidelines

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

Cache-Control Directives

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

Common Recipes

# 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

Conditional Requests

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.

Application Caching

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

Redis vs Memcached

FeatureRedisMemcachedData structuresStrings, hashes, lists, sets, sorted setsStrings onlyPersistenceAOF, RDB snapshotsNonePub/SubYesNoMax value size512 MB1 MBVerdictDefault choicePure cache at extreme scale

Distributed Caching

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.

Cache Eviction Policies

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.

Caching Layers

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

Cache Stampede Prevention

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

Cache Warming

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.

Monitoring

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 Do

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

Category context

Agent frameworks, memory systems, reasoning layers, and model-native orchestration.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
2 Docs
  • SKILL.md Primary doc
  • README.md Docs