redis_py_async

Cliente Python async para Redis sin bloquear el event loop

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "redis_py_async" with this command: npx skills add davidcastagnetoa/skills/davidcastagnetoa-skills-redis-py-async

redis_py_async

redis-py con soporte async nativo permite operaciones Redis no bloqueantes desde FastAPI y otros frameworks asyncio. Reemplaza al deprecado aioredis que ahora está integrado en redis-py 4.2+.

When to use

Usar en todos los agentes Python que acceden a Redis a través del cache_agent. Nunca usar el cliente síncrono en handlers async de FastAPI.

Instructions

  1. Instalar: pip install redis[hiredis] (hiredis para parser C de alto rendimiento).
  2. Crear pool de conexiones async:
    import redis.asyncio as aioredis
    pool = aioredis.ConnectionPool.from_url('redis://localhost:6379', max_connections=20)
    client = aioredis.Redis(connection_pool=pool)
    
  3. Usar en handlers: value = await client.get('key').
  4. Usar pipeline para operaciones múltiples:
    async with client.pipeline() as pipe:
        pipe.get('key1')
        pipe.get('key2')
        results = await pipe.execute()
    
  5. Cerrar pool en shutdown: await pool.disconnect().
  6. Configurar socket_timeout=2 y socket_connect_timeout=1.

Notes

  • hiredis es 10x más rápido que el parser Python puro; siempre instalarlo.
  • El pool de conexiones evita el overhead de conectar/desconectar en cada operación.
  • aioredis standalone está deprecado; usar redis.asyncio de redis-py >= 4.2.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

github_actions_cicd

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

datamodel_code_generator

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

device_fingerprinting

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

prometheus_client

No summary provided by upstream source.

Repository SourceNeeds Review