class

Vug::CacheManager

Inherits Reference < Object

Constructors

new(config : Config, memory_cache : MemoryCache | Nil = nil)
Source

Instance methods

get(url : String) : String | Nil

Retrieves a cached path for the given URL.

Lookup order:

  1. Config-backed storage (on_load callback) โ€” persistent store
  2. In-memory cache โ€” fast ephemeral layer
Source
set(url : String, local_path : String) : Nil

Stores a URL โ†’ path mapping in the memory cache layer only.

Note: This method does not invoke the on_save config callback. Persistence is handled earlier in the pipeline by ImageProcessor::Default#process_bytes, which calls @config.save before storing the result in the cache. This design avoids double-save when the image processor has already persisted the data.

If you need to trigger persistence, call @config.save explicitly or route through the full Fetcher pipeline.

Source