caching-redis

Redis caching patterns for storing temporary results and controlling how long they remain available. Redis is a fast data store often used for caches and request limits.

In plain words
What is it for?
Use them for caching job analysis, company research, user profiles, workflow state, language-model responses, interview preparation, outreach, and CV optimization. They also cover rate limiting with response headers.
Why use it?
They provide consistent cache keys, expiry times, and versioning so old cached data can be cleared safely. They also define a lock pattern to prevent duplicate work.

Cursor rule for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/eliornl/rolemule/caching-redis
Clone the repo
git clone --depth 1 https://github.com/eliornl/rolemule

Made for: Claude Code.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,319 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02319
Opus 5 $0.00000 $0.01159
Sonnet 5 $0.00000 $0.00464
Haiku 4.5 $0.00000 $0.00232

Measured 2d ago against content hash fc9e71af6529, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

caching-redis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/rules/caching-redis.mdc · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Caching & Rate Limiting Patterns

Cache Schema Version

All keys are prefixed with CACHE_VERSION (currently v1). Bump CACHE_VERSION in utils/cache.py to instantly flush all caches on deploy — old keys expire via TTL.

Cache TTLs and Key Patterns

Cache TTL Key pattern
Job analysis 24h v1:job_analysis:{hash} — hash includes URL + up to 50,000 chars of normalized job text (_MAX_JOB_CONTENT_FOR_CACHE_KEY in utils/cache.py) so different listings on the same long page do not share one cache entry
Company research 7d v1:company_research:{hash}:{name}
User profile 5min v1:user_profile:{uuid}
Workflow state 1min v1:workflow_state:{session_id}
LLM response 1h v1:llm_response:{user_id}:{hash} (user-scoped) or v1:llm_response:{hash} (shared)
Interview prep 7d v1:interview_prep:{session_id}
Hiring outreach 7d v1:hiring_outreach:{session_id}
Hiring outreach generating 10min v1:hiring_outreach_generating:{session_id} — atomic SET NX lock
CV optimization result 24h v1:cv_optimization:{session_id}get_cached_cv_optimization() unwraps cache_set {"data": ...} wrapper
CV optimization running 30min v1:cv_optimization_running:{session_id} — atomic SET NX lock
Mock interview thinking 3min v1:mock_interview_thinking:{session_id} — atomic SET NX turn lock
Tool result 1h v1:tool_result:{tool_name}:{hash}

Auth-Specific Redis Keys (managed by api/auth.py and utils/auth.py)

These keys are not versioned with CACHE_VERSION — do not flush them as part of cache invalidation.

Purpose TTL Key pattern
JWT revocation blocklist Remaining token lifetime + 60 s jwt_blocklist:{jti}
OAuth CSRF state 10 min oauth_state:{state_token}
OAuth one-time exchange code 30 s oauth_code:{code}
Password reset token 1 h password_reset:{token}
Email verification code 15 min email_verification:{code}
Email verification current-code pointer 15 min email_verification_user:{email}

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 185 lines · 2,319 tokens per session scan A fc9e71af6529

Subscribe to this mod's changes

caching-redis is a cursor rule published in the GitHub repository eliornl/rolemule (37 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,319 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other cursor rules, from other repositories

cursorrules

Agent2 is a framework for building production AI agents with typed HTTP APIs. PydanticAI handles the agent loop. Agent2 handles everything else: API, auth, pause/resume, approvals, provider routing, knowledge search.

Artesiana/agent2 · 399 tokens

product-manager

Holistic product leader who owns the full product lifecycle — from discovery and strategy through roadmap, stakeholder alignment, go-to-market, and outcome measurement. Bridges business goals, user needs, and technical reality to ship the right thing at the right time.

Treevu-ai/cli-market-world · 5,350 tokens

developer-advocate

Expert developer advocate specializing in building developer communities, creating compelling technical content, optimizing developer experience (DX), and driving platform adoption through authentic engineering engagement. Bridges product and engineering teams with external developers.

Treevu-ai/cli-market-world · 38 tokens

api-tester

Expert API testing specialist focused on comprehensive API validation, performance testing, and quality assurance across all systems and third-party integrations.

Treevu-ai/cli-market-world · 23 tokens

architectural-and-structural-rules

The project follows a layered architecture with clear separation of concerns.

mrharishkumar/fastapi-cursor-boilerplate · 559 tokens

angular-20

This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.

angular/angular · 0 tokens