{
  "schemaVersion": "1.0",
  "item": {
    "slug": "smart-cache",
    "name": "Smart Cache",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/raghulpasupathi/smart-cache",
    "canonicalUrl": "https://clawhub.ai/raghulpasupathi/smart-cache",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/smart-cache",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=smart-cache",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "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. 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. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/smart-cache"
    },
    "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/smart-cache",
    "agentPageUrl": "https://openagent3.xyz/skills/smart-cache/agent",
    "manifestUrl": "https://openagent3.xyz/skills/smart-cache/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/smart-cache/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. 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. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Smart Cache",
        "body": "High-performance caching with multiple eviction strategies."
      },
      {
        "title": "Implementation",
        "body": "class SmartCache {\n  constructor(options = {}) {\n    this.strategy = options.strategy || 'lru'; // 'lru' or 'lfu'\n    this.maxSize = options.maxSize || 500;\n    this.defaultTTL = options.defaultTTL || 3600000; // 1 hour\n    \n    this.cache = new Map();\n    this.accessCount = new Map();\n    this.accessOrder = [];\n  }\n\n  set(key, value, ttl = this.defaultTTL) {\n    // Evict if at capacity\n    if (this.cache.size >= this.maxSize && !this.cache.has(key)) {\n      this.evict();\n    }\n\n    const entry = {\n      value,\n      expiresAt: Date.now() + ttl,\n      createdAt: Date.now()\n    };\n\n    this.cache.set(key, entry);\n    this.accessCount.set(key, 0);\n    this.updateAccessOrder(key);\n\n    return true;\n  }\n\n  get(key) {\n    const entry = this.cache.get(key);\n\n    if (!entry) {\n      return { hit: false, value: null };\n    }\n\n    // Check TTL\n    if (Date.now() > entry.expiresAt) {\n      this.delete(key);\n      return { hit: false, value: null, reason: 'expired' };\n    }\n\n    // Update access tracking\n    this.accessCount.set(key, (this.accessCount.get(key) || 0) + 1);\n    this.updateAccessOrder(key);\n\n    return { hit: true, value: entry.value };\n  }\n\n  delete(key) {\n    this.cache.delete(key);\n    this.accessCount.delete(key);\n    this.accessOrder = this.accessOrder.filter(k => k !== key);\n  }\n\n  evict() {\n    if (this.strategy === 'lru') {\n      this.evictLRU();\n    } else if (this.strategy === 'lfu') {\n      this.evictLFU();\n    }\n  }\n\n  evictLRU() {\n    // Remove least recently used\n    if (this.accessOrder.length > 0) {\n      const keyToEvict = this.accessOrder[0];\n      this.delete(keyToEvict);\n    }\n  }\n\n  evictLFU() {\n    // Remove least frequently used\n    let minCount = Infinity;\n    let keyToEvict = null;\n\n    for (const [key, count] of this.accessCount.entries()) {\n      if (count < minCount) {\n        minCount = count;\n        keyToEvict = key;\n      }\n    }\n\n    if (keyToEvict) {\n      this.delete(keyToEvict);\n    }\n  }\n\n  updateAccessOrder(key) {\n    // Remove from current position\n    this.accessOrder = this.accessOrder.filter(k => k !== key);\n    // Add to end (most recent)\n    this.accessOrder.push(key);\n  }\n\n  clear() {\n    this.cache.clear();\n    this.accessCount.clear();\n    this.accessOrder = [];\n  }\n\n  getStats() {\n    return {\n      size: this.cache.size,\n      maxSize: this.maxSize,\n      strategy: this.strategy,\n      hitRate: this.calculateHitRate()\n    };\n  }\n\n  calculateHitRate() {\n    // Simplified - would track actual hits/misses in production\n    return Math.round((this.cache.size / this.maxSize) * 100);\n  }\n}\n\n// Export for OpenClaw\nmodule.exports = { SmartCache };"
      },
      {
        "title": "Usage",
        "body": "const cache = new skills.smartCache.SmartCache({\n  strategy: 'lru',\n  maxSize: 500,\n  defaultTTL: 3600000\n});\n\n// Set value\ncache.set('key1', { data: 'value' }, 60000);\n\n// Get value\nconst result = cache.get('key1');\nif (result.hit) {\n  console.log('Cache hit:', result.value);\n}\n\n// Stats\nconsole.log(cache.getStats());"
      },
      {
        "title": "Configuration",
        "body": "{\n  \"strategy\": \"lru\",\n  \"maxSize\": 500,\n  \"defaultTTL\": 3600000\n}"
      }
    ],
    "body": "Smart Cache\n\nHigh-performance caching with multiple eviction strategies.\n\nImplementation\nclass SmartCache {\n  constructor(options = {}) {\n    this.strategy = options.strategy || 'lru'; // 'lru' or 'lfu'\n    this.maxSize = options.maxSize || 500;\n    this.defaultTTL = options.defaultTTL || 3600000; // 1 hour\n    \n    this.cache = new Map();\n    this.accessCount = new Map();\n    this.accessOrder = [];\n  }\n\n  set(key, value, ttl = this.defaultTTL) {\n    // Evict if at capacity\n    if (this.cache.size >= this.maxSize && !this.cache.has(key)) {\n      this.evict();\n    }\n\n    const entry = {\n      value,\n      expiresAt: Date.now() + ttl,\n      createdAt: Date.now()\n    };\n\n    this.cache.set(key, entry);\n    this.accessCount.set(key, 0);\n    this.updateAccessOrder(key);\n\n    return true;\n  }\n\n  get(key) {\n    const entry = this.cache.get(key);\n\n    if (!entry) {\n      return { hit: false, value: null };\n    }\n\n    // Check TTL\n    if (Date.now() > entry.expiresAt) {\n      this.delete(key);\n      return { hit: false, value: null, reason: 'expired' };\n    }\n\n    // Update access tracking\n    this.accessCount.set(key, (this.accessCount.get(key) || 0) + 1);\n    this.updateAccessOrder(key);\n\n    return { hit: true, value: entry.value };\n  }\n\n  delete(key) {\n    this.cache.delete(key);\n    this.accessCount.delete(key);\n    this.accessOrder = this.accessOrder.filter(k => k !== key);\n  }\n\n  evict() {\n    if (this.strategy === 'lru') {\n      this.evictLRU();\n    } else if (this.strategy === 'lfu') {\n      this.evictLFU();\n    }\n  }\n\n  evictLRU() {\n    // Remove least recently used\n    if (this.accessOrder.length > 0) {\n      const keyToEvict = this.accessOrder[0];\n      this.delete(keyToEvict);\n    }\n  }\n\n  evictLFU() {\n    // Remove least frequently used\n    let minCount = Infinity;\n    let keyToEvict = null;\n\n    for (const [key, count] of this.accessCount.entries()) {\n      if (count < minCount) {\n        minCount = count;\n        keyToEvict = key;\n      }\n    }\n\n    if (keyToEvict) {\n      this.delete(keyToEvict);\n    }\n  }\n\n  updateAccessOrder(key) {\n    // Remove from current position\n    this.accessOrder = this.accessOrder.filter(k => k !== key);\n    // Add to end (most recent)\n    this.accessOrder.push(key);\n  }\n\n  clear() {\n    this.cache.clear();\n    this.accessCount.clear();\n    this.accessOrder = [];\n  }\n\n  getStats() {\n    return {\n      size: this.cache.size,\n      maxSize: this.maxSize,\n      strategy: this.strategy,\n      hitRate: this.calculateHitRate()\n    };\n  }\n\n  calculateHitRate() {\n    // Simplified - would track actual hits/misses in production\n    return Math.round((this.cache.size / this.maxSize) * 100);\n  }\n}\n\n// Export for OpenClaw\nmodule.exports = { SmartCache };\n\nUsage\nconst cache = new skills.smartCache.SmartCache({\n  strategy: 'lru',\n  maxSize: 500,\n  defaultTTL: 3600000\n});\n\n// Set value\ncache.set('key1', { data: 'value' }, 60000);\n\n// Get value\nconst result = cache.get('key1');\nif (result.hit) {\n  console.log('Cache hit:', result.value);\n}\n\n// Stats\nconsole.log(cache.getStats());\n\nConfiguration\n{\n  \"strategy\": \"lru\",\n  \"maxSize\": 500,\n  \"defaultTTL\": 3600000\n}"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/raghulpasupathi/smart-cache",
    "publisherUrl": "https://clawhub.ai/raghulpasupathi/smart-cache",
    "owner": "raghulpasupathi",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/smart-cache",
    "downloadUrl": "https://openagent3.xyz/downloads/smart-cache",
    "agentUrl": "https://openagent3.xyz/skills/smart-cache/agent",
    "manifestUrl": "https://openagent3.xyz/skills/smart-cache/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/smart-cache/agent.md"
  }
}