Creates a new cache entry, but only if the key does not already exist. Has no effect if the key already exists.
Readable execution context for the operation
Cache key to add
Value to cache
Time-to-live duration for this entry. Pass null to cache without expiration.
true if the entry was created, false if the key already existed
Retrieves a value by key without removing it.
Readable execution context for the operation
Cache key to retrieve
The cached value, or null if not found or expired
Retrieves a value by key and immediately removes it. Useful for one-time-use values (tokens, temporary states, etc.).
Readable execution context for the operation
Cache key to retrieve and remove
The cached value, or null if not found or expired
Increments a numeric cache entry by a given amount. Useful for counters, rates, and statistics.
Readable execution context for the operation
Cache key to increment
Amount to increment by.
true if the entry was incremented, false if the key did not exist
Creates a new cache entry or updates an existing one (upsert). Also updates the TTL when overwriting an existing entry.
Readable execution context for the operation
Cache key to set
Value to cache
Time-to-live duration for this entry. Pass null to cache without expiration.
true if the entry was added, false if it was updated
Removes all cache entries. Use with caution as this completely clears the cache.
Readable execution context for the operation
Removes all cache entries whose keys start with a given prefix. Useful for invalidating groups of related cache entries.
Readable execution context for the operation
Key prefix to match for removal
Removes multiple cache entries at once.
Readable execution context for the operation
Array of cache keys to remove
true if at least one key was removed, false if none existed
Updates an existing cache entry without changing its TTL. Has no effect if the key does not exist.
Readable execution context for the operation
Cache key to update
New value to cache
true if the entry was updated, false if the key did not exist
Low-level adapter contract for cache storage operations. Defines CRUD operations for key-value pairs with expiration support. This contract abstracts away the underlying cache storage technology (Redis, Memcached, database, etc.).
IMPORT_PATH:
"@daiso-tech/core/cache/contracts"