preheat_open.configuration.CacheConfig

class preheat_open.configuration.CacheConfig

Bases: ConfigBase

Cache configuration settings.

Controls how the application caches data.

Attributes:

type (str): The cache type to use directory (str): Path to the cache directory size_limit (float): Maximum size of the cache in bytes time_to_live (int): Maximum lifetime of cached items in seconds runtime_mode (int): The current runtime mode

__init__()

Initialize configuration from environment variables.

Methods

__init__()

Initialize configuration from environment variables.

iter_items()

Iterate over all attributes of the configuration object.

pretty_print([anonymize])

Create a string representation with sensitive fields masked.

temporary()

Return a context manager that temporarily sets environment variables.

Attributes

directory

runtime_mode

size_limit

time_to_live

type

update

Get a proxy object to update configuration attributes and environment variables.

class TempContext(config_obj)

Bases: Generic[T]

Context manager for temporarily setting environment variables.

iter_items()

Iterate over all attributes of the configuration object.

Return type:

Generator[tuple[str, Any], None, None]

Yields:

tuple[str, Any]: A tuple of attribute name and value

pretty_print(anonymize=None)

Create a string representation with sensitive fields masked.

Return type:

str

Returns:

str: String representation of the configuration

temporary()

Return a context manager that temporarily sets environment variables.

Return type:

TempContext[T]

Usage:
with config.temporary():

# Environment variables reflect config values here

# Original environment variables restored here

Returns:

TempContext: A context manager that preserves the specific config type

property update: UpdateProxy

Get a proxy object to update configuration attributes and environment variables.