一键导入
redis-patterns
Redis 패턴 가이드. Cache-Aside, Rate Limiting, Pub/Sub, Streams 구현 시 참조. "redis", "cache", "rate limit", "pubsub", "streams" 키워드로 트리거.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Redis 패턴 가이드. Cache-Aside, Rate Limiting, Pub/Sub, Streams 구현 시 참조. "redis", "cache", "rate limit", "pubsub", "streams" 키워드로 트리거.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Chat Eval Pipeline 코드에 대한 5-expert 피드백 루프 리뷰 가이드
Agent 시스템 프로비저닝 가이드. Dependencies 싱글톤, HTTP 클라이언트 풀링, LLM 클라이언트 설정, 환경변수 관리, Worker 초기화 패턴. "dependencies", "provisioning", "http client", "connection pool", "worker setup" 키워드로 트리거.
Google Gemini SDK (google-genai) 활용 가이드. Gemini 3/2 모델, Structured Output, Function Calling, Google Search Grounding, 이미지 생성 구현 시 참조. "gemini", "google ai", "genai", "google search", "imagen" 키워드로 트리거.
LangGraph 1.0+ 파이프라인 구축 가이드. Intent-Routed Workflow, Subagent 패턴, Checkpointing, Conditional Routing 구현 시 참조. "langgraph", "pipeline", "graph", "workflow", "subagent", "checkpointer" 키워드로 트리거.
LangSmith 통합 및 LLM Observability 가이드. 토큰 추적, 비용 계산, Run Tree, Tracing 데코레이터, OTEL 연동 구현 시 참조. "langsmith", "tracing", "observability", "token usage", "cost tracking" 키워드로 트리거.
OpenAI Agents SDK (2025~) 활용 가이드. Agent + Runner + WebSearchTool + RunContextWrapper 패턴. Structured Output, Function Tool, Handoff 구현 시 참조. "agents sdk", "openai agent", "runner", "web_search", "function_tool", "handoff" 키워드로 트리거.
| name | redis-patterns |
| description | Redis 패턴 가이드. Cache-Aside, Rate Limiting, Pub/Sub, Streams 구현 시 참조. "redis", "cache", "rate limit", "pubsub", "streams" 키워드로 트리거. |
┌─────────────────────────────────────────────────────────────────────────┐
│ Redis Usage in Eco² │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Cache-Aside (L1) │
│ ├─ LangGraph Checkpoint 캐시 │
│ ├─ Intent Classification 캐시 │
│ └─ Session State 캐시 │
│ │
│ Rate Limiting │
│ └─ API 요청 제한 (Sliding Window) │
│ │
│ Pub/Sub │
│ └─ SSE 실시간 이벤트 (sse:events:{job_id}) │
│ │
│ Streams │
│ ├─ 이벤트 버퍼 ({domain}:events:{shard}) │
│ └─ State KV ({domain}:state:{job_id}) │
│ │
│ Human-in-the-Loop │
│ ├─ 입력 요청 (input:request:{job_id}) │
│ └─ 상호작용 상태 (interaction:state:{job_id}) │
│ │
└─────────────────────────────────────────────────────────────────────────┘
async def get_with_cache(
key: str,
fetch_fn: Callable[[], Awaitable[T]],
ttl: int = 3600,
) -> T:
"""Cache-Aside 패턴"""
# 1. 캐시 조회
cached = await redis.get(key)
if cached:
return deserialize(cached)
# 2. 원본 조회
data = await fetch_fn()
# 3. 캐시 저장
await redis.setex(key, ttl, serialize(data))
return data
async def check_rate_limit(
key: str,
limit: int,
window_seconds: int,
) -> bool:
"""Sliding Window Rate Limit"""
now = time.time()
window_start = now - window_seconds
pipe = redis.pipeline()
pipe.zremrangebyscore(key, 0, window_start) # 오래된 기록 제거
pipe.zadd(key, {str(now): now}) # 현재 요청 추가
pipe.zcard(key) # 요청 수 확인
pipe.expire(key, window_seconds)
_, _, count, _ = await pipe.execute()
return count <= limit
async def publish_event(job_id: str, event: dict) -> None:
"""이벤트 발행"""
channel = f"sse:events:{job_id}"
await redis.publish(channel, json.dumps(event))
async def subscribe_events(job_id: str) -> AsyncIterator[dict]:
"""이벤트 구독"""
pubsub = redis.pubsub()
await pubsub.subscribe(f"sse:events:{job_id}")
async for message in pubsub.listen():
if message["type"] == "message":
yield json.loads(message["data"])
async def consume_stream(
stream: str,
group: str,
consumer: str,
) -> AsyncIterator[tuple[str, dict]]:
"""Consumer Group 기반 스트림 소비"""
while True:
messages = await redis.xreadgroup(
groupname=group,
consumername=consumer,
streams={stream: ">"},
block=5000,
count=100,
)
for stream_name, events in messages:
for event_id, data in events:
yield event_id, data
await redis.xack(stream_name, group, event_id)
| 인스턴스 | K8s 서비스 | 용도 |
|---|---|---|
| Streams | rfr-streams-redis.redis.svc.cluster.local:6379 | Streams, State KV (영속) |
| Pub/Sub | rfr-pubsub-redis.redis.svc.cluster.local:6379 | 실시간 전송 (휘발) |
# ConfigMap 환경변수 예시
CHAT_WORKER_REDIS_STREAMS_URL: redis://rfr-streams-redis.redis.svc.cluster.local:6379/0
CHAT_WORKER_REDIS_PUBSUB_URL: redis://rfr-pubsub-redis.redis.svc.cluster.local:6379/0
rfr-streams-redis: # Streams, State KV (영속)
- AOF 활성화
- Checkpoint 데이터
- Consumer Group
rfr-pubsub-redis: # Pub/Sub (휘발)
- 실시간 전송 전용
- SSE Gateway 구독