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.0.tar.gz (9.7 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.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muscles_data_redis-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 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.0.tar.gz
Algorithm Hash digest
SHA256 4387337d161eadc9b8d719ff17a199b07c120627834a57f0ac710811d9eb2168
MD5 3a693c7e70593395943658aef7c29374
BLAKE2b-256 a3a529c38d6d632a9a945ca10b03f25393c853a74224d52dcb5d043eee3740f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_redis-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muscles_data_redis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74644e15214f15c37ed6e52a68fc599bdedc0d75d322d7dc82838dc699accad4
MD5 40f62b2c760dd2dd6540cf5ea86d060e
BLAKE2b-256 54c241ee182c1386b512a7d649b064a14721d42e760ee33d74eb5afd6ad56205

See more details on using hashes here.

Provenance

The following attestation bundles were made for muscles_data_redis-0.1.0-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