Skip to content

Caching

$bolt.cacheSet(cKey, cValue)

Store value in cache (no expiry).

$bolt.cacheSet("user:123", $bolt.jsonEncode(userData))

$bolt.cacheSetTTL(cKey, cValue, nTTL)

Store value in cache with a TTL in seconds.

$bolt.cacheSetTTL("user:123", data, 300)  # Expires in 5 minutes

$bolt.cacheGet(cKey)

Retrieve value from cache. Returns empty string if not found.

data = $bolt.cacheGet("user:123")
if data != ""
    user = $bolt.jsonDecode(data)
ok

$bolt.cacheDelete(cKey)

Delete cache entry.

$bolt.cacheDelete("user:123")

$bolt.cacheClear()

Clear entire cache.

$bolt.cacheClear()