Releases: nalgeon/redka
v0.5.3
v0.5.2
Redka now supports the following SQLite drivers:
github.com/mattn/go-sqlite3
(seeexample/simple/main.go
)github.com/ncruces/go-sqlite3
(seeexample/ncruces/main.go
)github.com/tursodatabase/go-libsql
(seeexample/libsql/main.go
)modernc.org/sqlite
(seeexample/modernc/main.go
)
Bug fixes:
- Case-insensitive string comparison in command parser (e.g.
nx
=NX
). - Enforce pragmas for every database connection (#28).
v0.5.1
Minor improvements:
- Custom pragmas in
redka.Options
. redka.OpenDB
function to use Redka with an existing database connection.LOLWUT
command, which will give you an answer to any yes/no question you throw at it.- macOS amd64 build, courtesy of @j178 (thanks, Jo!)
127.0.0.1:6380> lolwut
Ask me a question (⊃。•́‿•̀。)⊃
127.0.0.1:6380> lolwut Is Redis cool?
Without a doubt
127.0.0.1:6380> lolwut Is SQLite cool?
Yes definitely
127.0.0.1:6380> lolwut Will Redka succeed?
Better not tell you now
v0.5.0
Redka aims to reimplement the good parts of Redis with SQLite, while remaining compatible with the Redis API. This release adds support for set commands.
All commands are available via the Redis wire protocol (RESP) and the Go API.
Installation • Usage • Roadmap
Sets
Redka supports the following set-related commands:
SADD
- Adds one or more members to a set.SCARD
- Returns the number of members in a set.SDIFF
- Returns the difference of multiple sets.SDIFFSTORE
- Stores the difference of multiple sets.SINTER
- Returns the intersection of multiple sets.SINTERSTORE
- Stores the intersection of multiple sets.SISMEMBER
- Determines whether a member belongs to a set.SMEMBERS
- Returns all members of a set.SMOVE
- Moves a member from one set to another.SPOP
- Returns a random member after removing it.SRANDMEMBER
- Returns a random member from a set.SREM
- Removes one or more members from a set.SSCAN
- Iterates over members of a set.SUNION
- Returns the union of multiple sets.SUNIONSTORE
- Stores the union of multiple sets.
No breaking changes this time, yay!
v0.4.0
Redka aims to reimplement the good parts of Redis with SQLite, while remaining compatible with the Redis API. This release adds support for list commands and improves throughput quite a bit (+20% for writes, +60% for reads).
All commands are available via the Redis wire protocol (RESP) and the Go API.
Installation • Usage • Roadmap
Special thanks to @yinzhidong for implementing the PING
command.
Lists
Redka supports the following list-related commands:
LINDEX
- Returns an element from a list by its index.LINSERT
- Inserts an element before or after another element in a list.LLEN
- Returns the length of a list.LPOP
- Returns the first element of a list after removing it.LPUSH
- Prepends an element to a list.LRANGE
- Returns a range of elements from a list.LREM
- Removes elements from a list.LSET
- Sets the value of an element in a list by its index.LTRIM
- Removes elements from both ends a list.RPOP
- Returns the last element of a list after removing it.RPOPLPUSH
- Removes the last element and pushes it to another list.RPUSH
- Appends an element to a list.
⚠️ Breaking changes
Until Redka reaches 1.0, I may introduce breaking changes with each release. Sorry for that.
rkey.DB
/ rkey.Tx
interface changes:
- Scan(cursor int, pattern string, count int) (ScanResult, error)
+ Scan(cursor int, pattern string, ktype core.TypeID, count int) (ScanResult, error)
- Scanner(pattern string, pageSize int) *Scanner
+ Scanner(pattern string, ktype core.TypeID, pageSize int) *Scanner
There are also some non-backward-compatible database schema changes, and I'd rather not introduce automated migrations until 1.0. If you are already using Redka in production and need a migration, let me know in the issues.
v0.3.0
Redka aims to reimplement the good parts of Redis with SQLite, while remaining compatible with the Redis API. This release adds support for sorted set commands.
All commands are available via the Redis wire protocol (RESP) and the Go API.
Installation • Usage • Roadmap
Special thanks to @behnambm for testing the EXPIREAT
command and @Gelma for fixing some typos.
Sorted sets
Redka supports the following sorted set related commands:
ZADD
- Adds or updates one or more members of a set.ZCARD
- Returns the number of members in a set.ZCOUNT
- Returns the number of members of a set within a range of scores.ZINCRBY
- Increments the score of a member in a set.ZINTER
- Returns the intersection of multiple sets.ZINTERSTORE
- Stores the intersection of multiple sets in a key.ZRANGE
- Returns members of a set within a range of indexes.ZRANGEBYSCORE
- Returns members of a set within a range of scores.ZRANK
- Returns the index of a member in a set ordered by ascending scores.ZREM
- Removes one or more members from a set.ZREMRANGEBYRANK
- Removes members of a set within a range of indexes.ZREMRANGEBYSCORE
- Removes members of a set within a range of scores.ZREVRANGE
- Returns members of a set within a range of indexes in reverse order.ZREVRANGEBYSCORE
- Returns members of a set within a range of scores in reverse order.ZREVRANK
- Returns the index of a member in a set ordered by descending scores.ZSCAN
- Iterates over members and scores of a set.ZSCORE
- Returns the score of a member in a set.ZUNION
- Returns the union of multiple sets.ZUNIONSTORE
- Stores the union of multiple sets in a key.
⚠️ Breaking changes
Until Redka reaches 1.0, I may introduce breaking changes with each release. Sorry for that.
Removed MSTENX
command. I never quite understood the use case for MSETNX, so I searched the Redis repo issues and StackOverflow. I didn't find a single real-world scenario for using this command, so I decided to remove it.
rkey.DB
/ rkey.Tx
interface changes:
- Expire(key string, ttl time.Duration) (bool, error)
+ Expire(key string, ttl time.Duration) error
- ExpireAt(key string, at time.Time) (bool, error)
+ ExpireAt(key string, at time.Time) error
- Persist(key string) (bool, error)
+ Persist(key string) error
rstring.DB
/ rstring.Tx
interface changes:
- GetSet(key string, value any, ttl time.Duration) (core.Value, error)
- SetExists(key string, value any, ttl time.Duration) (bool, error)
- SetManyNX(items map[string]any) (bool, error)
- SetNotExists(key string, value any, ttl time.Duration) (bool, error)
+ SetWith(key string, value any) rstring.SetCmd
v0.2.0
Redka aims to reimplement the good parts of Redis with SQLite, while remaining compatible with the Redis API. This release adds support for hash commands.
All commands are available via the Redis wire protocol (RESP) and the Go API.
Installation • Usage • Roadmap
Hashes
Redka supports the following hash-related commands:
HDEL
- Deletes one or more fields and their values.HEXISTS
- Determines whether a field exists.HGET
- Returns the value of a field.HGETALL
- Returns all fields and values.HINCRBY
- Increments the integer value of a field.HINCRBYFLOAT
- Increments the float value of a field.HKEYS
- Returns all fields.HLEN
- Returns the number of fields.HMGET
- Returns the values of multiple fields.HMSET
- Sets the values of multiple fields.HSCAN
- Iterates over fields and values.HSET
- Sets the values of one ore more fields.HSETNX
- Sets the value of a field when it doesn't exist.HVALS
- Returns all values.
v0.1.0
Redka aims to reimplement the good parts of Redis with SQLite, while remaining compatible with the Redis API. The first release on the way to 1.0 brings string commands, key management and transactions.
All commands are available via the Redis wire protocol (RESP) and the Go API.
Installation • Usage • Roadmap
Strings
Redka supports the following string-related commands:
DECR
- Decrements the integer value of a key by one.DECRBY
- Decrements a number from the integer value of a key.GET
- Returns the string value of a key.GETSET
- Sets the key to a new value and returns the prev value.INCR
- Increments the integer value of a key by one.INCRBY
- Increments the integer value of a key by a number.INCRBYFLOAT
- Increments the float value of a key by a number.MGET
- Returns the string values of one or more keys.MSET
- Sets the string values of one or more keys.MSETNX
- Sets the string values of one or more keys when all keys don't exist.PSETEX
- Sets the string value and expiration time (in ms) of a key.SET
- Sets the string value of a key.SETEX
- Sets the string value and expiration (in sec) time of a key.SETNX
- Sets the string value of a key when the key doesn't exist.
Key management
Redka supports the following key management (generic) commands:
DEL
- Deletes one or more keys.EXISTS
- Determines whether one or more keys exist.EXPIRE
- Sets the expiration time of a key (in seconds).EXPIREAT
- Sets the expiration time of a key to a Unix timestamp.KEYS
- Returns all key names that match a pattern.PERSIST
- Removes the expiration time of a key.PEXPIRE
- Sets the expiration time of a key in ms.PEXPIREAT
- Sets the expiration time of a key to a Unix ms timestamp.RANDOMKEY
- Returns a random key name from the database.RENAME
- Renames a key and overwrites the destination.RENAMENX
- Renames a key only when the target key name doesn't exist.SCAN
- Iterates over the key names in the database.
Transactions
Redka supports the following transaction commands:
DISCARD
- Discards a transaction.EXEC
- Executes all commands in a transaction.MULTI
- Starts a transaction.