Skip to content
Kona

Cache

Kona’s cache layer gives you a small, Laravel-shaped API for storing values by key with optional TTLs.

val cache = CacheManager(config, basePath, redisManager).store()
cache.put("answer", 42, 60)
val value = cache.get("answer")
val computed = cache.remember("profile", 120) { loadProfile() }

Configure cache.default and cache.stores.{name}.driver:

Driver Behavior
array / memory Process-local map (great for tests)
file JSON files under storage/framework/cache/data (or cache.stores.file.path)
redis Uses RedisManager with cache.prefix
  • get / put / forever / forget / flush
  • has / missing / add
  • remember / rememberForever / pull