redis

redis is a cursor rule for Cursor from nedcodes-ok/cursorrules-collection. It costs 468 tokens per session, scanned A, original, MIT.

A set of coding rules for Redis, an in-memory data store used for fast lookups, caching, queues, and messaging. It covers data structures, key naming, expiration, caching, and performance.

In plain words
What is it for?
Use it when choosing Redis data structures, adding cache behavior, building queues or leaderboards, or implementing pub/sub and event streams.
Why use it?
It helps prevent stale or unlimited cache entries, slow commands, confusing keys, and unnecessary network round trips.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Good fit Use it when choosing Redis data structures, adding cache behavior, building queues…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/redis
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.

Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for redis

README.md
[![agentmods](https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/redis.svg)](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/redis)
Your own site
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/redis"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/redis.svg" alt="Measured on agentmods" height="20"></a>
Per session 468 This file is loaded in full into every session.
When invoked 468 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00468 $0.00468
Opus 5 $0.00234 $0.00234
Sonnet 5 $0.00094 $0.00094
Haiku 4.5 $0.00047 $0.00047

Measured 3d ago against content hash 63862b1627e6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

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 3d 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.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

rules-mdc/tools/redis.mdc · 50 lines

What it actually says

Redis Cursor Rules

You are an expert Redis developer. Follow these rules:

Data Structures

  • Strings for simple key-value and counters (INCR/DECR are atomic)
  • Hashes for objects — HSET user:123 name "Alice" email "alice@..."
  • Sorted sets for leaderboards, rate limiters, priority queues
  • Lists for queues (LPUSH/RPOP) and activity feeds
  • Sets for unique collections and intersection/union operations
  • Streams for event sourcing and message queues

Key Design

  • Namespace keys with colons: user:123:session, post:456:likes
  • Keep keys short but readable — abbreviate namespaces in high-volume scenarios
  • Set TTL on every cache key — no key should live forever without reason
  • Use SCAN over KEYS — KEYS blocks the single-threaded server

Caching Patterns

  • Cache-aside: app checks cache, falls back to DB, writes to cache
  • Write-through for data that must stay consistent
  • TTL-based invalidation for most use cases. Event-based for critical consistency
  • Serialize as JSON or MessagePack — avoid language-specific formats
  • Cache stampede prevention: use locks or stale-while-revalidate

Performance

  • Pipeline multiple commands to reduce round trips
  • Lua scripts for atomic multi-step operations (EVAL/EVALSHA)
  • Avoid large values (>100KB) — split into smaller keys
  • Use OBJECT ENCODING to verify memory-efficient encodings
  • Monitor with INFO stats, SLOWLOG, and CLIENT LIST

Pub/Sub & Streams

  • Pub/Sub for fire-and-forget broadcasting — messages are lost if no subscriber
  • Streams for persistent messaging with consumer groups
  • XACK processed messages. Set MAXLEN to cap stream size
  • Use consumer groups for distributed work distribution

Operations

  • Redis Sentinel for high availability, Redis Cluster for horizontal scaling
  • RDB snapshots for backups. AOF for durability
  • maxmemory-policy: allkeys-lru for caches, noeviction for primary data
  • Monitor memory with INFO memory — watch fragmentation ratio
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. 3d ago First seen · 50 lines · 468 tokens per session scan A 63862b1627e6

Subscribe to this mod's changes

redis is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 468 tokens to every session, about $0.0023 per session on Opus 5. 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-09-03.