Atomically increments a counter.
Acquires a distributed lock using SET NX EX.
Releases a lock using a Lua script for atomicity.
Gets a value from Redis.
Sets a value in Redis.
OptionalsetSets a value with TTL for automatic expiration.
OptionaldeleteDeletes a key from Redis.
Executes a Lua script atomically.
The Lua script to execute
Array of keys (will be prefixed)
Array of arguments
The script's return value
Atomically assigns a nonce using Vana App's battle-tested logic.
The key for storing the last used nonce
The current pending transaction count from blockchain
The assigned nonce
This is a Redis-specific optimization that uses a Lua script for atomic nonce assignment with gap prevention. This method is called by DistributedNonceManager when it detects a Redis store.
Ported from apps/web/app/api/relay/route.ts (Vana App production code) DO NOT MODIFY without thorough testing in production environment.
Redis-backed implementation of IAtomicStore.
Remarks
This implementation uses Redis's native atomic operations:
Redis is ideal for this use case because:
Example