root_mcp.common.cache module

Caching utilities shared between core and extended modes.

class root_mcp.common.cache.LRUCache(max_size)[source]

Bases: Generic[T]

Generic LRU cache implementation.

Parameters:

max_size (int)

__init__(max_size)[source]

Initialize LRU cache.

Parameters:

max_size (int) – Maximum number of items to cache

clear()[source]

Clear the cache.

Return type:

None

get(key)[source]

Get item from cache.

Parameters:

key (str) – Cache key

Returns:

Cached item or None if not found

Return type:

T | None

put(key, value)[source]

Add item to cache.

Parameters:
  • key (str) – Cache key

  • value (T) – Item to cache

Return type:

None

size()[source]

Get current cache size.

Return type:

int