Skip to main content

Module cache

Module cache 

Source
Expand description

Workspace indexing and refactoring orchestration. Bounded LRU caches for workspace index components.

This module provides thread-safe, bounded caches with LRU eviction policies for AST nodes, symbols, and workspace data. These caches enforce memory limits while maintaining high hit rates for frequently accessed data.

§Performance Characteristics

  • Cache hit rate: >90% for typical workloads
  • Eviction latency: O(1) amortized with linked hash map
  • Memory overhead: ~32 bytes per cache entry
  • Thread safety: Lock-free reads with atomic reference counting

§Cache Configuration

  • AST Node Cache: Max 10,000 nodes, 50MB memory limit
  • Symbol Cache: Max 50,000 symbols, 30MB memory limit
  • Workspace Cache: Max 1,000 files, 20MB memory limit

§Usage

use perl_workspace_index::workspace::cache::{BoundedLruCache, CacheConfig};

let config = CacheConfig::default();
let cache = BoundedLruCache::new(config);

cache.insert("key", "value");
assert_eq!(cache.get("key"), Some(&"value"));

Structs§

AstCacheConfig
AST node cache configuration.
BoundedLruCache
Thread-safe bounded LRU cache.
CacheConfig
Cache configuration for bounded LRU caches.
CacheStats
Cache statistics for monitoring and diagnostics.
CombinedWorkspaceCacheConfig
Combined cache configuration for all workspace caches.
SymbolCacheConfig
Symbol cache configuration.
WorkspaceCacheConfig
Workspace cache configuration.

Traits§

EstimateSize
Trait for estimating the memory size of cached values.