Skip to main content

Redis integration for the Pico ecosystem: shared client, distributed cache backend for pico-caching.

Project description

pico-data-redis

PyPI Ask DeepWiki License: MIT CI (tox matrix) codecov Quality Gate Status Duplicated Lines (%) Maintainability Rating PyPI Downloads Docs Interactive Lab

Redis for the pico ecosystem: a shared injectable client, and a distributed backend that makes @cacheable (pico-caching) work across processes. Installing it is opting in.

Installation

pip install pico-data-redis

Quick start

redis:
  url: redis://cache.internal:6379/0

Inject the shared client anywhere:

from redis import Redis
from pico_ioc import component

@component
class Sessions:
    def __init__(self, redis: Redis):
        self._redis = redis

With pico-caching installed, @cacheable methods automatically use Redis instead of process memory — no code changes, the interceptor prefers any non-in-memory backend:

from pico_caching import cacheable

@component
class Reports:
    @cacheable(ttl_seconds=300)
    def heavy_query(self, day: str) -> dict: ...

Notes:

  • Cached values are pickled — treat the Redis instance as trusted, private infrastructure.
  • The backend fails open: an unreachable Redis degrades to cache misses, never to errors.
  • Keys are namespaced under redis.cache_prefix (default pico:cache:); clear() only touches that namespace.
  • The client's pool closes on container shutdown.

Documentation

Full documentation: https://dperezcabrera.github.io/pico-data-redis/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pico_data_redis-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_data_redis-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pico_data_redis-0.1.0.tar.gz.

File metadata

  • Download URL: pico_data_redis-0.1.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_data_redis-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b89c1126cddabc8c84a7ab34835481af7eb769313d63b0c713b9fbe3a817b167
MD5 af40f27a149ff1caee888aa64ba5065f
BLAKE2b-256 711fff8c00dd37bc113dc8fea72caae94034dda70978090aae8c5fc877a04258

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_data_redis-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-data-redis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pico_data_redis-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pico_data_redis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5bd7e0bb8ec41faea64a870bec8ee407cbe9758bad0353bc290bfa998f657ad
MD5 b3a21d4eb7875a6a63ed679232975a17
BLAKE2b-256 d6cc7b7060321f424500dd1518caf3bf3fa23aa5360a19d71170b42606ea882d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_data_redis-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-data-redis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page