{
  "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": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/caching",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=caching",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "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."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "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."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/caching",
    "agentPageUrl": "https://openagent3.xyz/skills/caching/agent",
    "manifestUrl": "https://openagent3.xyz/skills/caching/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/caching/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "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."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Caching Patterns",
        "body": "A well-placed cache is the cheapest way to buy speed. A misplaced cache is the most expensive way to buy bugs."
      },
      {
        "title": "Cache Strategies",
        "body": "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\n\nCache-Aside Flow:\n\n  App ──► Cache ──► HIT? ──► Return data\n              │\n              ▼ MISS\n          Read DB ──► Store in Cache ──► Return data"
      },
      {
        "title": "Cache Invalidation",
        "body": "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"
      },
      {
        "title": "TTL Guidelines",
        "body": "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"
      },
      {
        "title": "Cache-Control Directives",
        "body": "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"
      },
      {
        "title": "Common Recipes",
        "body": "# Immutable static assets (hashed filenames)\nCache-Control: public, max-age=31536000, immutable\n\n# API response, CDN-cached, background refresh\nCache-Control: public, s-maxage=60, stale-while-revalidate=300\n\n# Personalized data, browser-only\nCache-Control: private, max-age=0, must-revalidate\nETag: \"abc123\"\n\n# Never cache (auth tokens, sensitive data)\nCache-Control: no-store"
      },
      {
        "title": "Conditional Requests",
        "body": "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\n\nPrefer ETag over Last-Modified — ETags detect content changes regardless of timestamp granularity."
      },
      {
        "title": "Application Caching",
        "body": "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"
      },
      {
        "title": "Redis vs Memcached",
        "body": "FeatureRedisMemcachedData structuresStrings, hashes, lists, sets, sorted setsStrings onlyPersistenceAOF, RDB snapshotsNonePub/SubYesNoMax value size512 MB1 MBVerdictDefault choicePure cache at extreme scale"
      },
      {
        "title": "Distributed Caching",
        "body": "ConcernSolutionPartitioningConsistent hashing — minimal reshuffling on node changesReplicationPrimary-replica — writes to primary, reads from replicasFailoverRedis Sentinel or Cluster auto-failover\n\nRule of thumb: 3 primaries + 3 replicas minimum for production Redis Cluster."
      },
      {
        "title": "Cache Eviction Policies",
        "body": "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\n\nRedis default is noeviction. Set maxmemory-policy to allkeys-lru or volatile-lru for production."
      },
      {
        "title": "Caching Layers",
        "body": "Browser Cache → CDN → Load Balancer → App Cache → DB Cache → Database\n\nLayerWhat 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"
      },
      {
        "title": "Cache Stampede Prevention",
        "body": "When a hot key expires, hundreds of requests simultaneously hit the database.\n\nTechniqueHow 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"
      },
      {
        "title": "Cache Warming",
        "body": "StrategyWhen to UseOn-deploy warm-upPredictable key set, latency-sensitiveBackground jobReports, dashboards, catalog dataShadow trafficCache migration, new infrastructurePriority-basedLimited warm-up time budget\n\nCold start impact: A full cache flush can increase DB load 10–100x. Always warm gradually or use stale-while-revalidate."
      },
      {
        "title": "Monitoring",
        "body": "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"
      },
      {
        "title": "NEVER Do",
        "body": "NEVER cache without a TTL or invalidation plan — data rots; every entry needs an expiry path\nNEVER treat cache as durable storage — caches evict, crash, and restart; always fall back to source of truth\nNEVER cache sensitive data (tokens, PII) without encryption — cache breaches expose everything in plaintext\nNEVER ignore cache stampede on hot keys — one expired popular key can take down your database\nNEVER use unbounded in-memory caches in production — memory grows until OOM-killed\nNEVER cache mutable data with immutable Cache-Control — browsers will never re-fetch\nNEVER skip monitoring hit/miss rates — you won't know if your cache is helping or hurting"
      }
    ],
    "body": "Caching Patterns\n\nA well-placed cache is the cheapest way to buy speed. A misplaced cache is the most expensive way to buy bugs.\n\nCache Strategies\nStrategy\tHow It Works\tWhen to Use\nCache-Aside (Lazy)\tApp checks cache → miss → reads DB → writes to cache\tDefault choice — general purpose\nRead-Through\tCache fetches from DB on miss automatically\tORM-integrated caching, CDN origin fetch\nWrite-Through\tWrites go to cache AND DB synchronously\tRead-heavy with strong consistency\nWrite-Behind\tWrites go to cache, async flush to DB\tHigh write throughput, eventual consistency OK\nRefresh-Ahead\tCache proactively refreshes before expiry\tPredictable access patterns, low-latency critical\nCache-Aside Flow:\n\n  App ──► Cache ──► HIT? ──► Return data\n              │\n              ▼ MISS\n          Read DB ──► Store in Cache ──► Return data\n\nCache Invalidation\nMethod\tConsistency\tWhen to Use\nTTL-based\tEventual (up to TTL)\tSimple data, acceptable staleness\nEvent-based\tStrong (near real-time)\tInventory, profile updates\nVersion-based\tStrong\tStatic assets, API responses, config\nTag-based\tStrong\tCMS content, category-based purging\nTTL Guidelines\nData Type\tTTL\tRationale\nStatic assets (CSS/JS/images)\t1 year + cache-busting hash\tImmutable by filename\nAPI config / feature flags\t30–60 seconds\tFast propagation needed\nUser profile data\t5–15 minutes\tTolerable staleness\nProduct catalog\t1–5 minutes\tBalance freshness vs load\nSession data\tMatch session timeout\tSecurity requirement\nHTTP Caching\nCache-Control Directives\nDirective\tMeaning\nmax-age=N\tCache for N seconds\ns-maxage=N\tCDN/shared cache max age (overrides max-age)\nno-cache\tMust revalidate before using cached copy\nno-store\tNever cache anywhere\nmust-revalidate\tOnce stale, must revalidate\nprivate\tOnly browser can cache, not CDN\npublic\tAny cache can store\nimmutable\tContent will never change (within max-age)\nstale-while-revalidate=N\tServe stale for N seconds while fetching fresh\nCommon Recipes\n# Immutable static assets (hashed filenames)\nCache-Control: public, max-age=31536000, immutable\n\n# API response, CDN-cached, background refresh\nCache-Control: public, s-maxage=60, stale-while-revalidate=300\n\n# Personalized data, browser-only\nCache-Control: private, max-age=0, must-revalidate\nETag: \"abc123\"\n\n# Never cache (auth tokens, sensitive data)\nCache-Control: no-store\n\nConditional Requests\nMechanism\tRequest Header\tResponse Header\tHow It Works\nETag\tIf-None-Match: \"abc\"\tETag: \"abc\"\tHash-based — 304 if match\nLast-Modified\tIf-Modified-Since: <date>\tLast-Modified: <date>\tDate-based — 304 if unchanged\n\nPrefer ETag over Last-Modified — ETags detect content changes regardless of timestamp granularity.\n\nApplication Caching\nSolution\tSpeed\tShared Across Processes\tWhen to Use\nIn-memory LRU\tFastest\tNo\tSingle-process, bounded memory, hot data\nRedis\tSub-ms (network)\tYes\tProduction default — TTL, pub/sub, persistence\nMemcached\tSub-ms (network)\tYes\tSimple key-value at extreme scale\nSQLite\tFast (disk)\tNo\tEmbedded apps, edge caching\nRedis vs Memcached\nFeature\tRedis\tMemcached\nData structures\tStrings, hashes, lists, sets, sorted sets\tStrings only\nPersistence\tAOF, RDB snapshots\tNone\nPub/Sub\tYes\tNo\nMax value size\t512 MB\t1 MB\nVerdict\tDefault choice\tPure cache at extreme scale\nDistributed Caching\nConcern\tSolution\nPartitioning\tConsistent hashing — minimal reshuffling on node changes\nReplication\tPrimary-replica — writes to primary, reads from replicas\nFailover\tRedis Sentinel or Cluster auto-failover\n\nRule of thumb: 3 primaries + 3 replicas minimum for production Redis Cluster.\n\nCache Eviction Policies\nPolicy\tHow It Works\tWhen to Use\nLRU\tEvicts least recently accessed\tDefault — general purpose\nLFU\tEvicts least frequently accessed\tSkewed popularity distributions\nFIFO\tEvicts oldest entry\tSimple, time-ordered data\nTTL\tEvicts after fixed duration\tData with known freshness window\n\nRedis default is noeviction. Set maxmemory-policy to allkeys-lru or volatile-lru for production.\n\nCaching Layers\nBrowser Cache → CDN → Load Balancer → App Cache → DB Cache → Database\n\nLayer\tWhat to Cache\tInvalidation\nBrowser\tStatic assets, API responses\tVersioned URLs, Cache-Control\nCDN\tStatic files, public API responses\tPurge API, surrogate keys\nApplication\tComputed results, DB queries, external API\tEvent-driven, TTL\nDatabase\tQuery plans, buffer pool, materialized views\tANALYZE, manual refresh\nCache Stampede Prevention\n\nWhen a hot key expires, hundreds of requests simultaneously hit the database.\n\nTechnique\tHow It Works\nMutex / Lock\tFirst request locks, fetches, populates; others wait\nProbabilistic early expiration\tRandom chance of refreshing before TTL\nRequest coalescing\tDeduplicate in-flight requests for same key\nStale-while-revalidate\tServe stale, refresh asynchronously\nCache Warming\nStrategy\tWhen to Use\nOn-deploy warm-up\tPredictable key set, latency-sensitive\nBackground job\tReports, dashboards, catalog data\nShadow traffic\tCache migration, new infrastructure\nPriority-based\tLimited warm-up time budget\n\nCold start impact: A full cache flush can increase DB load 10–100x. Always warm gradually or use stale-while-revalidate.\n\nMonitoring\nMetric\tHealthy Range\tAction if Unhealthy\nHit rate\t> 90%\tLow → cache too small, wrong TTL, bad key design\nEviction rate\tNear 0 steady state\tHigh → increase memory or tune policy\nLatency (p99)\t< 1ms (Redis)\tHigh → network issue, large values, hot key\nMemory usage\t< 80% of max\tApproaching max → scale up or tune eviction\nNEVER Do\nNEVER cache without a TTL or invalidation plan — data rots; every entry needs an expiry path\nNEVER treat cache as durable storage — caches evict, crash, and restart; always fall back to source of truth\nNEVER cache sensitive data (tokens, PII) without encryption — cache breaches expose everything in plaintext\nNEVER ignore cache stampede on hot keys — one expired popular key can take down your database\nNEVER use unbounded in-memory caches in production — memory grows until OOM-killed\nNEVER cache mutable data with immutable Cache-Control — browsers will never re-fetch\nNEVER skip monitoring hit/miss rates — you won't know if your cache is helping or hurting"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/wpank/caching",
    "publisherUrl": "https://clawhub.ai/wpank/caching",
    "owner": "wpank",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "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"
  }
}