rosedblabs / rosedb

Lightweight, fast and reliable key/value storage engine based on Bitcask.
https://rosedblabs.github.io
Apache License 2.0
4.54k stars 631 forks source link

Proposal: get or delete keys by pattern #317

Open victor-gapeev opened 3 weeks ago

victor-gapeev commented 3 weeks ago

In my standalone Golang application, I utilize RoseDB and distribute it to the client as an .exe. This application acts as a server that supports multiple sessions for a single account. The keys I use to store session refresh tokens are formatted as session_<user_id>_<device_id>. When a user is deleted from the server, I also need to remove all their sessions. This requires me to map through every existing key and see if it begins with session_<user_id>. I cannot save a refresh token in JSON with session_<user_id> keys because it would cause performance issues, as checking tokens happens with each request, unlike user deletion. Therefore, I really need something similar to the KEYS or SCAN methods in Redis.

roseduan commented 3 weeks ago

method Ascend or AscendKeys will be useful for you.