haive.core.engine.document.loaders.cache_manager¶

Cache manager for document loader registry.

This module provides caching functionality to speed up document loader initialization by avoiding repeated scanning of 230+ loader modules.

Classes¶

RegistryCacheManager

Manages caching of document loader registry data.

Functions¶

clear_loader_cache()

Clear the document loader cache.

get_cache_manager()

Get the global cache manager instance.

get_cache_status()

Get current cache status information.

Module Contents¶

class haive.core.engine.document.loaders.cache_manager.RegistryCacheManager(cache_dir=None, cache_ttl_days=7, use_memory_cache=True)[source]¶

Manages caching of document loader registry data.

This significantly speeds up imports by caching: - Discovered source modules - Registered loaders and their configurations - Source type mappings - Loader capabilities

Cache is invalidated when: - Source files are modified - Package version changes - Cache expires (default 7 days) - User explicitly clears cache

Initialize cache manager.

Parameters:
  • cache_dir (pathlib.Path | None) – Directory for cache files (default: ~/.cache/haive/loaders)

  • cache_ttl_days (int) – Cache time-to-live in days

  • use_memory_cache (bool) – Whether to use in-memory caching for current session

clear_cache()[source]¶

Clear all cache files and memory cache.

Return type:

None

get_cache_info()[source]¶

Get information about current cache status.

Returns:

Dictionary with cache information

Return type:

dict[str, Any]

get_cached_registry()[source]¶

Get cached registry data if valid.

Returns:

Cached registry data or None if cache is invalid/missing

Return type:

dict[str, Any] | None

save_registry_cache(registry_data, source_files=None)[source]¶

Save registry data to cache.

Parameters:
  • registry_data (dict[str, Any]) – Registry data to cache

  • source_files (set[pathlib.Path] | None) – Set of source files that were scanned

Returns:

True if cache was saved successfully

Return type:

bool

haive.core.engine.document.loaders.cache_manager.clear_loader_cache()[source]¶

Clear the document loader cache.

Use this when you’ve installed new packages or made changes to loader implementations.

Return type:

None

haive.core.engine.document.loaders.cache_manager.get_cache_manager()[source]¶

Get the global cache manager instance.

Return type:

RegistryCacheManager

haive.core.engine.document.loaders.cache_manager.get_cache_status()[source]¶

Get current cache status information.

Return type:

dict[str, Any]