Configuration for the write-lock behaviour.
A factory that creates named locks. Each lock is keyed by the cache key to ensure concurrent writes to the same cache entry are serialised while writes to different entries can proceed in parallel.
OptionalonlyMethods?: WithCacheWriteLockMethods[]The subset of mutating methods to protect with a write lock. When omitted, all mutating methods are protected.
A middleware plugin that wraps an ICacheAdapter.
IMPORT_PATH: "@daiso-tech/core/cache/plugins"
Creates a plugin that acquires a distributed lock before executing mutating cache operations.
This plugin wraps write operations (
add,put,update,increment,getAndRemove,removeMany) with a lock acquired via ILockFactory. The lock key is derived from the cache key, ensuring that concurrent writes to the same cache entry are serialised. By default all mutating methods are protected; useonlyMethodsto restrict which operations are locked.