Skip to content

v0.3.0

Compare
Choose a tag to compare
@github-actions github-actions released this 26 Apr 07:24
· 48 commits to main since this release

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.

InstallationUsageRoadmap

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