pynenc_redis.builder¶
Redis plugin builder extensions for Pynenc.
This module contains the Redis-specific builder methods that will be moved to the pynenc-redis plugin package. It demonstrates how plugins can extend PynencBuilder with backend-specific functionality using the entry points system.
Key components:
RedisBuilderPlugin: Plugin class that registers Redis methods
redis(): Main method for full Redis stack configuration
redis_client_data_store(): Redis-specific argument caching method
redis_trigger(): Redis-specific trigger system method
Module Contents¶
Classes¶
Redis plugin that provides builder methods for Redis backend configuration. |
Functions¶
Configure Redis components for the Pynenc application. |
|
Configure Redis-based argument caching. |
|
Configure Redis-based trigger system. |
|
Validate Redis plugin configuration. |
API¶
- class pynenc_redis.builder.RedisBuilderPlugin[source]¶
Redis plugin that provides builder methods for Redis backend configuration.
This class will be moved to the pynenc-redis plugin package and registered via entry points to extend PynencBuilder with Redis-specific methods.
- static register_builder_methods(builder_class: type[pynenc.builder.PynencBuilder]) None[source]¶
Register Redis builder methods with PynencBuilder.
This method is called automatically when the plugin is discovered via entry points.
- Parameters:
builder_class (type[“PynencBuilder”]) – The PynencBuilder class to extend
- pynenc_redis.builder.redis(builder: pynenc.builder.PynencBuilder, url: str | None = None, db: int | None = None) pynenc.builder.PynencBuilder[source]¶
Configure Redis components for the Pynenc application.
This sets up all Redis-related components (orchestrator, broker, state backend, and argument cache) to use Redis as their backend.
- Parameters:
builder (PynencBuilder) – The PynencBuilder instance
url (str | None) – The Redis URL to connect to. If specified, overrides all other connection parameters including host, port, and db
db (int | None) – The Redis database number to use. Only valid when url is not provided. If url is provided, the database should be specified in the URL itself
- Returns:
The builder instance for method chaining
- Raises:
ValueError – If both url and db are provided, since url takes precedence
- pynenc_redis.builder.redis_client_data_store(builder: pynenc.builder.PynencBuilder, min_size_to_cache: int = 1024, local_cache_size: int = 1024) pynenc.builder.PynencBuilder[source]¶
Configure Redis-based argument caching.
This method configures the Redis argument cache with the specified parameters. It requires that Redis components have been configured either through redis() or through configuration files.
- Parameters:
builder (PynencBuilder) – The PynencBuilder instance
min_size_to_cache (int) – Minimum string length (in characters) required to cache an argument. Arguments smaller than this size will be passed directly. Default is 1024 characters (roughly 1KB)
local_cache_size (int) – Maximum number of items to cache locally. Default is 1024
- Returns:
The builder instance for method chaining
- Raises:
ValueError – If Redis configuration is not present
- pynenc_redis.builder.redis_trigger(builder: pynenc.builder.PynencBuilder, scheduler_interval_seconds: int = 60, enable_scheduler: bool = True) pynenc.builder.PynencBuilder[source]¶
Configure Redis-based trigger system.
This method configures the Redis trigger system with the specified parameters. It requires that Redis components have been configured either through redis() or through configuration files.
- Parameters:
- Returns:
The builder instance for method chaining
- Raises:
ValueError – If Redis configuration is not present
- pynenc_redis.builder.validate_redis_config(config: dict[str, Any]) None[source]¶
Validate Redis plugin configuration.
This function validates that Redis configuration is present when Redis components are being used. It’s called automatically during the build process.
- Parameters:
config (dict[str, Any]) – The builder configuration dictionary
- Raises:
ValueError – If Redis configuration is invalid