Skip to main content

Redis KeyValuePort, LockPort and StreamPort adapter for muscles-data

Project description

muscles-data-redis

Redis adapter package for muscles-data.

This package is intentionally separate from muscles-data: the core package owns typed ports, resource runtime and diagnostics, while this package owns Redis-backed KeyValuePort, LockPort and StreamPort implementations.

Related packages

Usage

Register the factory in the project composition root:

from muscles_data.catalog import DataAdapterCatalog
from muscles_data.ports import KeyValuePort
from muscles_data.runtime import DataRuntime
from muscles_data_redis import RedisDataFactory

catalog = DataAdapterCatalog.with_defaults()
catalog.register(RedisDataFactory())

runtime = DataRuntime(config=config, catalog=catalog)
cache = runtime.require_port("cache.redis", KeyValuePort)

Resource config stays in the project:

data:
  resources:
    cache.redis:
      type: redis
      url_env: REDIS_URL
      namespace: app
      timeout: 3
      stream_group: workers
      consumer: index-worker

The adapter creates the Redis client lazily by key-value, lock, stream, explicit native access or data.doctor operations. Application code should use KeyValuePort, LockPort and StreamPort; direct client access is only an advanced escape hatch with native_client: true.

Streams use XADD, XREADGROUP and XACK. The configured consumer group is created on first read and messages use the versioned muscles.data.message.v1 envelope. Retry and dead-letter decisions stay with the application worker.

See muscular-example/example_data_redis_1 for an executable example.

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

muscles_data_redis-0.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

muscles_data_redis-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file muscles_data_redis-0.1.1.tar.gz.

File metadata

  • Download URL: muscles_data_redis-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for muscles_data_redis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d98046b633a3c5da0586ae5bf24a19c2cf3d03000e0bf2fb27721d8ac8158bb6
MD5 e4917b9685fc27c6120428c5d395c135
BLAKE2b-256 55de6ccf62209222be76757ed89da6aae156600a3c8f827fbe13f3bfe3f71f1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_redis-0.1.1.tar.gz:

Publisher: release.yml on butkoden/muscles-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 muscles_data_redis-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_redis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bdf606ac458a552be90e0248a51208a82b56fbc946099f87e1b0d858b7f270
MD5 08fc238c56197bd3730f2e4b44d50346
BLAKE2b-256 ea8c90bb0786ec3b78a54113beb4b2080dd8000f8d55e07f8d64f6629bb150d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_redis-0.1.1-py3-none-any.whl:

Publisher: release.yml on butkoden/muscles-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