Skip to content

API Reference parrot.stores.kb.cache

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.stores.kb.cache

View source

Class CacheEntry

Cache entry with TTL support.

Parameter Type Default Description
value Any
expires_at datetime
hit_count int 0

Fields:

Field Type Default Description
value Any
expires_at datetime
hit_count int 0

Attributes:

Attribute Type Description
is_expired bool

Method CacheEntry.accessed

Track cache hits for analytics.

accessed()

Class TTLCache

Thread-safe TTL cache with memory management.

Parameter Type Default Description
max_size int 1000
default_ttl int 300
cleanup_interval int 60

Method TTLCache.start

Start the cleanup background task.

start()

Method TTLCache.stop

Stop the cleanup task.

stop()

Method TTLCache.get

Get value from cache.

get(key: str, default: Any = None) -> Optional[Any]

Parameter Type Default Description
key str
default Any None

Returns: Optional[Any]

Method TTLCache.set

Set value in cache with TTL.

set(key: str, value: Any, ttl: Optional[int] = None)

Parameter Type Default Description
key str
value Any
ttl Optional[int] None

Method TTLCache.invalidate

Invalidate cache entries matching pattern.

invalidate(pattern: str = None)

Parameter Type Default Description
pattern str None

Method TTLCache.get_stats

Get cache statistics.

get_stats() -> Dict[str, Any]

Returns: Dict[str, Any]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally