Skip to content

Cache

In-memory key-value cache with TTL support.

4 modules

ModuleDescription
Cache ClearClear all cache entries or filter by pattern
Cache DeleteDelete a cache entry by key
Cache GetGet a value from cache by key
Cache SetSet a value in cache with optional TTL

Modules

Cache Clear

cache.clear

Clear all cache entries or filter by pattern

Parameters:

NameTypeRequiredDefaultDescription
patternstringNo*Glob pattern to match keys (e.g. "user:", default "" clears all)
backendstringNomemoryCache backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
cleared_countnumberNumber of cache entries cleared
backendstringThe backend used

Cache Delete

cache.delete

Delete a cache entry by key

Parameters:

NameTypeRequiredDefaultDescription
keystringYes-The cache key to delete
backendstringNomemoryCache backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
keystringThe cache key
deletedbooleanWhether the key was found and deleted
backendstringThe backend used

Cache Get

cache.get

Get a value from cache by key

Parameters:

NameTypeRequiredDefaultDescription
keystringYes-The cache key to look up
backendstringNomemoryCache backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
keystringThe cache key
valueanyThe cached value (null if not found)
hitbooleanWhether the key was found in cache
backendstringThe backend used

Cache Set

cache.set

Set a value in cache with optional TTL

Parameters:

NameTypeRequiredDefaultDescription
keystringYes-The cache key to store the value under
valuestringYes-The value to cache (any JSON-serializable value)
ttlnumberNo0Time-to-live in seconds (0 = no expiry)
backendstringNomemoryCache backend to use
redis_urlstringNoredis://localhost:6379Redis connection URL

Output:

FieldTypeDescription
keystringThe cache key
storedbooleanWhether the value was stored successfully
ttlnumberThe TTL in seconds (0 = no expiry)
backendstringThe backend used

Released under the Apache 2.0 License.