Module: Ukiryu::CacheRegistry

Defined in:
lib/ukiryu/cache_registry.rb

Overview

Centralized cache registry for managing all Ukiryu caches.

Provides a single point of control for:

  • Clearing all caches (useful for testing)

  • Getting cache statistics (useful for debugging)

  • Accessing individual caches by name

Examples:

Clear all caches

Ukiryu::CacheRegistry.clear_all

Get cache statistics

Ukiryu::CacheRegistry.stats
# => { tool_cache: { size: 10, hits: 100, misses: 5 }, ... }

Class Method Summary collapse

Class Method Details

.cachesArray<Cache>

Get all registered caches

Returns:

  • (Array<Cache>)

    list of cache instances



23
24
25
26
27
28
# File 'lib/ukiryu/cache_registry.rb', line 23

def caches
  [
    ToolCache.cache,
    Definition::Loader.profile_cache
  ].compact
end

.clear_allvoid

This method returns an undefined value.

Clear all registered caches



33
34
35
36
# File 'lib/ukiryu/cache_registry.rb', line 33

def clear_all
  caches.each(&:clear)
  nil
end

.statsHash

Get statistics for all caches

Returns:

  • (Hash)

    cache name => stats hash



41
42
43
44
45
46
# File 'lib/ukiryu/cache_registry.rb', line 41

def stats
  {
    tool_cache: cache_stats(ToolCache.cache),
    definition_cache: cache_stats(Definition::Loader.profile_cache)
  }.compact
end