#redis #compare #swap #cas #add #native #module

redis-cas

Redis native module to add support for compare and swap

2 stable releases

1.1.0 Mar 22, 2024
1.0.1 Oct 10, 2022

#676 in Database interfaces

Download history 29/week @ 2024-02-21 139/week @ 2024-02-28 183/week @ 2024-03-20 7/week @ 2024-03-27 19/week @ 2024-04-03

209 downloads per month

MIT license

4KB

Redis CAS (Compare and Swap)

License Cargo Documentation

Redis native module to add support for compare and swap

Syntax

CAS key current_value new_value

Compare the value of a key and set if the passed current value hasn't changed

Return

Returns number of modified keys

Example usage

127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> cas foo bar baz
(integer) 1
127.0.0.1:6379> cas foo bar baz
(integer) 0

Build and load with taskfile

task load-redis-module

lib.rs:

Redis native module to add support for compare and swap

Dependencies

~8–12MB
~237K SLoC