Protected ReadonlyoptionsProtected ReadonlyscriptAtomic extension with TTL feedback and race condition protection
Redis key
Expected value
Minimum TTL required for extension (race condition protection)
New TTL to set in milliseconds
Promise resolving to atomic extension result with TTL feedback
Atomically acquire multiple locks in a single operation All-or-nothing semantics: either all locks are acquired or none
Array of Redis keys to lock
Array of values (one per key, same length as keys)
Time to live in milliseconds for all locks
Promise resolving to batch acquisition result
Clear all locks and timers (useful in test beforeEach/afterEach)
Delete key
Key to delete
Promise resolving to number of deleted keys
Delete key only if value matches (atomic operation)
Redis key
Expected value
Promise resolving to true if deleted, false otherwise
Disconnect from Redis
Promise that resolves when disconnected
Extend TTL of a key only if value matches (atomic operation)
Redis key
Expected value
New TTL in milliseconds
Promise resolving to true if extended, false otherwise
Get value by key
Redis key
Promise resolving to value or null if not found
Atomically inspect a lock's current state Returns the lock value (owner) and remaining TTL in a single operation
Redis key to inspect
Promise resolving to LockInspection if key exists, null otherwise
ProtectedinterpretCheck if adapter is connected
Connection status
ProtectedparseParse batch acquisition script result into BatchAcquireResult Ensures consistent handling across all adapters
Lua script result [resultCode, countOrIndex, failedKey?]
Original keys array for fallback lookup
BatchAcquireResult object
ProtectedparseParse inspection script result into LockInspection object Ensures consistent handling of Lua array return value across all adapters
Lua script result [value, ttl] or null
LockInspection object or null if key doesn't exist
Ping Redis server
Promise resolving to 'PONG'
ProtectedprefixAdds prefix to key if configured
Set key with value if not exists, with TTL in milliseconds
Redis key
Value to set
Time to live in milliseconds
Promise resolving to 'OK' on success, null if key exists
ProtectedstripProtectedvalidateValidate batch acquisition parameters Ensures consistent validation across all adapters
ProtectedvalidateValidates lock key format and requirements
ProtectedvalidateValidates TTL (time-to-live) value
ProtectedvalidateValidates lock value format and requirements
ProtectedwithStaticcreateFactory method to create adapter with options
Optionaloptions: RedisAdapterOptions
In-memory Redis adapter for testing without a real Redis instance.
TESTING ONLY: This adapter is NOT suitable for production use. It lacks persistence, cross-process synchronization, and network reliability.
This adapter implements the full RedisAdapter interface using an in-memory Map, allowing unit tests to run without Docker or Redis dependencies.
Key behaviors: