Add optional CAS operation to KvStore
This commit introduces an optional `cas` (compare-and-swap) method to the `KvStore` interface, enabling atomic updates. This is useful for implementing optimistic locking and preventing lost updates in concurrent environments. The following implementations have been updated: - `MemoryKvStore`: Implemented `cas` method. - `DenoKvStore`: Implemented `cas` method using Deno KV's atomic operations. - `WorkersKvStore`: Noted that Cloudflare Workers KV does not support atomic CAS operations. Test cases have been added for the `MemoryKvStore` and `DenoKvStore` implementations.
Loading
Please register or sign in to comment