cache global. Every key is automatically scoped to the current brand — scripts can never read or write keys belonging to another brand.
Values are JSON-serialised, so you can store strings, numbers, booleans, arrays, and plain objects.
cache.get(key)
Retrieve a value from the cache.
Returns: The stored value, or
null if the key does not exist or has expired.
cache.set(key, value, ttlSeconds?)
Store a value in the cache with an optional TTL.
Returns:
true on success, false if the brand key limit was reached or an error occurred.
cache.del(key)
Delete a key from the cache.
Returns:
true on success.
cache.has(key)
Check whether a key exists in the cache.
Returns:
true if the key exists, false otherwise.
cache.setIfAbsent(key, value, ttlSeconds?)
Write a value only if the key does not already exist. Useful for debouncing and deduplication.
Returns:
true if the value was written (key was absent), false if the key already existed.
cache.increment(key, amount?, ttlSeconds?)
Atomically increment a numeric value. Creates the key with the given amount if it doesn’t exist.
Returns: The new numeric value after incrementing.
Limits per brand:
- 50,000 keys maximum per brand
- 512 bytes maximum value size
- 1-hour maximum TTL
- 20 cache operations per script execution