How ponder2000/cache works
This is an in-memory Go cache library with key-value and FIFO-list caches, per-item expiration, and pooled janitors that periodically purge registered caches. The principal workflow is: a caller creates a cache and janitor pool, registers caches, then the janitors invoke each cache’s purge operation on a ticker. The graph also shows the public facade, cache interface and shared item-expiration model. Edges are limited to relationships visible in the excerpts or README; unsampled behavior is omitted.
Main entry points: cache.go Cache Facade · cacher.go Cache Interfaces · pool.go Janitor Pool · keyvalue/cache.go Key-Value Cache
Components 9
Public API
- Cache Facade
cache.go - Cache Interfaces
pkg/container/cacher.go
Cache Stores
- Key-Value Cache
pkg/container/keyvalue/cache.go - FIFO List Cache
pkg/container/list/cache.go
Expiration Core
- Expiring Item
pkg/core/item.go
Janitor Cleanup
- Janitor Config
pkg/janitor/config.go - Janitor Pool
pkg/janitor/pool.go - Janitor Worker
pkg/janitor/janitor.go
Other components
- Library Caller
Connections 13
- Library Caller → Cache Facade: uses
README.md - Cache Facade → Janitor Config: creates config
cache.go - Cache Facade → Janitor Pool: creates pool
cache.go - Cache Facade → Cache Interfaces: creates caches
cache.go - Cache Facade → Key-Value Cache: creates map cache
cache.go - Cache Facade → FIFO List Cache: creates list cache
cache.go - Cache Interfaces → Key-Value Cache: constructs
pkg/container/cacher.go - Cache Interfaces → FIFO List Cache: constructs
pkg/container/cacher.go - Janitor Pool → Janitor Worker: creates and starts
pkg/janitor/pool.go - Janitor Pool → Janitor Config: uses options
pkg/janitor/pool.go - Janitor Worker → Cache Interfaces: purges caches
pkg/janitor/janitor.go - Key-Value Cache → Expiring Item: creates and checks
pkg/container/keyvalue/cache.go - FIFO List Cache → Expiring Item: creates and checks
pkg/container/list/cache.go