Skip to content
Back to skills

2185 Caching Strategy E7386a48

ASecurity

```typescript import { LRUCache } from 'lru-cache';

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 31, 2026
businesstypescript

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 2185-caching-strategy_e7386a48 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2185 Caching Strategy E7386a48?

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

Security grade badge for 2185 Caching Strategy E7386a48
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2185-caching-strategy-e7386a48/badge)](https://www.skillsdirectory.com/skills/tools-only-2185-caching-strategy-e7386a48)

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
# Caching Strategy

## Caching Strategy

### Response Caching
```typescript
import { LRUCache } from 'lru-cache';

const cache = new LRUCache<string, any>({
  max: 1000,
  ttl: 30000, // 1 minute
  updateAgeOnGet: true,
});

async function cachedSupabaseRequest<T>(
  key: string,
  fetcher: () => Promise<T>,
  ttl?: number
): Promise<T> {
  const cached = cache.get(key);
  if (cached) return cached as T;

  const result = await fetcher();
  cache.set(key, result, { ttl });
  return result;
}
```

### Redis Caching (Distributed)
```typescript
import Redis from 'ioredis';

const redis = new Redis(process.env.REDIS_URL);

async function cachedWithRedis<T>(
  key: string,
  fetcher: () => Promise<T>,
  ttlSeconds = 60
): Promise<T> {
  const cached = await redis.get(key);
  if (cached) return JSON.parse(cached);

  const result = await fetcher();
  await redis.setex(key, ttlSeconds, JSON.stringify(result));
  return result;
}
```

Files in this skill

  • README.md1.1 KB
  • skill.md939 B

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.