mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
feat(server): Allow configuration of hashtag extraction (#2890)
* feat(server): Allow configuration of hashtag extraction Before this PR: Hashtags, if enabled, meant the text between `{` and `}` in the key (if exists and non-empty). After this PR: * Hashtags can _still_ be enabled / disabled * Hashtag open / close char can be specified (and can be the same), like `:` popular with BullMQ * Hashtag can include `N` closing tags to skip, like `{a}b}c}d` with `2` will return `a}b}c`. This will allow some existing systems to migrate without code changes in client code.
This commit is contained in:
parent
f6f7cfb2c9
commit
256e07f8ba
8 changed files with 128 additions and 31 deletions
|
@ -53,8 +53,16 @@ class CommandId;
|
|||
class Transaction;
|
||||
class EngineShard;
|
||||
|
||||
struct LockTagOptions {
|
||||
bool enabled = false;
|
||||
char open_locktag = '{';
|
||||
char close_locktag = '}';
|
||||
unsigned skip_n_end_delimiters = 0;
|
||||
std::string prefix;
|
||||
};
|
||||
|
||||
struct KeyLockArgs {
|
||||
static bool IsLockHashTagEnabled();
|
||||
static LockTagOptions GetLockTagOptions();
|
||||
|
||||
// Before acquiring and releasing keys, one must "normalize" them via GetLockKey().
|
||||
static std::string_view GetLockKey(std::string_view key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue