py_alpaca_api.cache.cache_config

Cache configuration for py-alpaca-api.

Classes

CacheType

Types of cache backends supported.

CacheConfig

Configuration for cache system.

Module Contents

class py_alpaca_api.cache.cache_config.CacheType(*args, **kwds)[source]

Bases: enum.Enum

Types of cache backends supported.

MEMORY = 'memory'[source]
REDIS = 'redis'[source]
DISABLED = 'disabled'[source]
class py_alpaca_api.cache.cache_config.CacheConfig[source]

Configuration for cache system.

cache_type[source]

Type of cache backend to use

max_size[source]

Maximum number of items in memory cache

default_ttl[source]

Default time-to-live in seconds

data_ttls[source]

TTL overrides per data type

redis_host[source]

Redis host (if using Redis)

redis_port[source]

Redis port (if using Redis)

redis_db[source]

Redis database number (if using Redis)

redis_password[source]

Redis password (if using Redis)

enabled[source]

Whether caching is enabled

cache_type: CacheType[source]
max_size: int = 1000[source]
default_ttl: int = 300[source]
data_ttls: dict[str, int][source]
redis_host: str = 'localhost'[source]
redis_port: int = 6379[source]
redis_db: int = 0[source]
redis_password: str | None = None[source]
enabled: bool = True[source]
get_ttl(data_type: str) int[source]

Get TTL for a specific data type.

Parameters:

data_type – Type of data to get TTL for

Returns:

TTL in seconds