Skip to content
Back to skills

Caching Strategy Implementer

BSecurity

Implement Cache-Aside, Write-Through, and TTL-based caching logic using Redis or in-memory LRU caches.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmentjavascriptpythongojavanode

Works with

  • cli

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 27, 2026

npx -y skills add RMAzrim/opencode-artes --skill caching-strategy-implementer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Caching Strategy Implementer?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Caching Strategy Implementer
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/rmazrim-caching-strategy-implementer/badge)](https://www.skillsdirectory.com/skills/rmazrim-caching-strategy-implementer)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Caching Strategy Implementer
description: Implement Cache-Aside, Write-Through, and TTL-based caching logic using Redis or in-memory LRU caches.
metadata:
  source: skills/caching-strategy-implementer/caching-strategy-implementer.md
---

# Caching Strategy Implementer

## Prerequisites & Dependencies
- Redis 7+ strongly recommended, or an in-memory cache (Node `node-cache`, Python `functools.lru_cache`)
- Language runtime: Node.js 18+, Python 3.10+, or Go 1.21+
- Optional: `npm i ioredis` / `pip install redis` / `go-redis` for Redis client

## Execution Steps
1. Choose the caching strategy based on data access patterns: Cache-Aside for read-heavy, Write-Through for write-heavy, TTL/LRU for eviction policies
2. Set up the Redis (or LRU) client with connection pooling and default TTL (e.g., 300s for session data, 86400s for product catalogs)
3. Implement **Cache-Aside**: on read, check cache first; miss → fetch from DB → populate cache; on write → invalidate/update cache entry
4. Implement **Write-Through**: every write goes through cache, which synchronously writes through to the underlying DB
5. Configure eviction policies: `maxmemory-policy allkeys-lru` in Redis, or `maxsize` + `ttl` in Node/Python caches
6. Add cache warming for critical paths and monitor hit/miss ratios via Redis `INFO stats` or Prometheus metrics
7. Benchmark read/write latency with and without cache, iterate TTL/size values

```javascript
// Cache-Aside pattern with ioredis (Node.js)
const Redis = require('ioredis');
const redis = new Redis();

async function getUser(id) {
  const cacheKey = `user:${id}`;
  const cached = await redis.get(cacheKey);
  if (cached) return JSON.parse(cached); // cache hit

  // cache miss → fetch from DB
  const user = await db.query('SELECT * FROM users WHERE id = $1', [id]);
  await redis.setex(cacheKey, 300, JSON.stringify(user)); // TTL 5min
  return user;
}

async function createUser(user) {
  const created = await db.query('INSERT INTO users ... RETURNING *');
  await redis.setex(`user:${created.id}`, 300, JSON.stringify(created)); // write-through style
  return created;
}
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.