Skip to main content

PyPI Python License

evoid-redis

Redis cache engine for EVOID — Intent Handler system

Quick StartIntent HandlerConfigAPI


Quick Start

uv add evoid-redis

Method 1: Intent Handler (Recommended)

from evoid_redis import register_handlers
from evoid.core.cache import cache_get, cache_set, cache_delete

# Register Redis as cache handler
register_handlers(url="redis://localhost:6379", prefix="myapp:")

# Use high-level API — goes through Intent pipeline
await cache_set("session:abc", {"user": "Alice"}, ttl=300)
data = await cache_get("session:abc")
await cache_delete("session:abc")

Method 2: Direct API

from evoid_redis import create_cache

cache = create_cache("redis://localhost:6379", prefix="myapp:")
await cache.set("key", {"data": "value"}, ttl=300)
data = await cache.get("key")

Intent Handler

evoid-redis registers these Intent handlers:

Intent Handler Description
cache.get handle_get Get value from Redis
cache.set handle_set Set value with optional TTL
cache.delete handle_delete Delete key
cache.exists handle_exists Check key existence
cache.health handle_health Ping Redis server

How it works

  1. register_handlers() registers Intent handlers for cache operations
  2. cache_get() / cache_set() create Intents and execute through pipeline
  3. Pipeline routes to Redis handler
  4. Handler connects to Redis and performs operation

Configuration

TOML

[engines]
cache = "redis"

[engines.options.redis]
url = "redis://localhost:6379"
prefix = "myapp:"

Python

from evoid.config import config

app = config(
    engines={
        "cache": "redis",
        "options": {
            "redis": {
                "url": "redis://prod:6379",
                "prefix": "production:",
            },
        },
    },
)

API

register_handlers(url, prefix)

Register Redis as Intent handlers.

Parameter Type Default Description
url str redis://localhost:6379 Redis connection URL
prefix str evoid: Key prefix

create_cache(url, prefix) -> RedisCache

Factory function for direct API access.

Methods

Method Signature Returns Description
get async get(key: str) Any | None Get value (auto JSON decode)
set async set(key: str, value: Any, ttl: int | None) bool Set value with optional TTL
delete async delete(key: str) bool Delete key
exists async exists(key: str) bool Check key exists
health async health() bool Ping Redis

Dependencies

  • evoid>=0.4.3
  • redis[hiredis]>=5.0.0

Optional

  • evoid-di>=0.1.0 — for DI integration (auto-registered when register_handlers() is called)

DI Integration

When you call register_handlers(), Redis is auto-registered as cache.redis in evoid-di:

from evoid_di import di

# After register_handlers(), this works:
cache = di.resolve("cache.redis")

# Or as a fallback for storage:
di.set_fallback("storage.postgresql", ["cache.redis"])

Links

License

MIT

Release files for evoid-redis 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for evoid-redis 0.2.0
File Interpreter ABI Platform
evoid_redis-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / evoid_redis-0.2.0-py3-none-any.whl

Download URL evoid_redis-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b77bfb9944383ddeba6fbb95a1e30037e67169aeee57025c949656aaa585ef9e
BLAKE2b-256 checksum
How to use checksums
9a01704003f377f0f3a692df9b35ffd5d071c49cc3921521de2cd8695c11efe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page