Creates a new cache entry, but only if the key does not already exist. Has no effect if the key already exists.
true if the entry was created, false if the key already existed
Retrieves a value by key without removing it.
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.).
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.
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.
true if the entry was added, false if it was updated
Removes all cache entries. Use with caution as this completely clears the cache.
Removes all cache entries whose keys start with a given prefix. Useful for invalidating groups of related cache entries.
Removes multiple cache entries at once.
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.
true if the entry was updated, false if the key did not exist
The
NoOpCacheAdapterwill do nothing and is used for easily mockingICachefor testing.IMPORT_PATH:
"@daiso-tech/core/cache/no-op-cache-adapter"