# Send caching to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
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

```text
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.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "caching",
    "name": "caching",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/wpank/caching",
    "canonicalUrl": "https://clawhub.ai/wpank/caching",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/caching",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=caching",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "caching",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-04T17:39:47.217Z",
      "expiresAt": "2026-05-11T17:39:47.217Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=caching",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=caching",
        "contentDisposition": "attachment; filename=\"caching-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "caching"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/caching"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/caching",
    "downloadUrl": "https://openagent3.xyz/downloads/caching",
    "agentUrl": "https://openagent3.xyz/skills/caching/agent",
    "manifestUrl": "https://openagent3.xyz/skills/caching/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/caching/agent.md"
  }
}
```
## Documentation

### 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
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: wpank
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-04T17:39:47.217Z
- Expires at: 2026-05-11T17:39:47.217Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/caching)
- [Send to Agent page](https://openagent3.xyz/skills/caching/agent)
- [JSON manifest](https://openagent3.xyz/skills/caching/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/caching/agent.md)
- [Download page](https://openagent3.xyz/downloads/caching)