@@ -58,6 +58,7 @@ weight: 1
58
58
* [ Server hooks implementation] ( #section-server-hooks-implementation )
59
59
* [ Module Configurations API] ( #section-module-configurations-api )
60
60
* [ RDB load/save API] ( #section-rdb-load-save-api )
61
+ * [ Config access API] ( #section-config-access-api )
61
62
* [ Key eviction API] ( #section-key-eviction-api )
62
63
* [ Miscellaneous APIs] ( #section-miscellaneous-apis )
63
64
* [ Defrag API] ( #section-defrag-api )
@@ -3166,7 +3167,7 @@ The returned `RedisModuleString` objects should be released with
3166
3167
3167
3168
mstime_t RedisModule_HashFieldMinExpire(RedisModuleKey *key);
3168
3169
3169
- ** Available since:** unreleased
3170
+ ** Available since:** 8.0.0
3170
3171
3171
3172
3172
3173
Retrieves the minimum expiration time of fields in a hash.
@@ -5042,7 +5043,13 @@ is interested in. This can be an ORed mask of any of the following flags:
5042
5043
this notification is wrong and discourage. It will
5043
5044
cause the read command that trigger the event to be
5044
5045
replicated to the AOF/Replica.
5045
- - ` REDISMODULE_NOTIFY_ALL ` : All events (Excluding ` REDISMODULE_NOTIFY_KEYMISS ` )
5046
+
5047
+ - ` REDISMODULE_NOTIFY_NEW ` : New key notification
5048
+ - ` REDISMODULE_NOTIFY_OVERWRITTEN ` : Overwritten events
5049
+ - ` REDISMODULE_NOTIFY_TYPE_CHANGED ` : Type-changed events
5050
+ - ` REDISMODULE_NOTIFY_ALL ` : All events (Excluding ` REDISMODULE_NOTIFY_KEYMISS ` ,
5051
+ REDISMODULE_NOTIFY_NEW, REDISMODULE_NOTIFY_OVERWRITTEN
5052
+ and REDISMODULE_NOTIFY_TYPE_CHANGED)
5046
5053
- ` REDISMODULE_NOTIFY_LOADED ` : A special notification available only for modules,
5047
5054
indicates that the key was loaded from persistence.
5048
5055
Notice, when this event fires, the given key
@@ -5650,7 +5657,7 @@ If the user is able to access the key then `REDISMODULE_OK` is returned, otherwi
5650
5657
RedisModuleString *prefix,
5651
5658
int flags);
5652
5659
5653
- ** Available since:** unreleased
5660
+ ** Available since:** 8.0.0
5654
5661
5655
5662
Check if the user can access keys matching the given key prefix according to the ACLs
5656
5663
attached to the user and the flags representing key access. The flags are the same that
@@ -7435,7 +7442,7 @@ Create an integer config that server clients can interact with via the
7435
7442
7436
7443
int RedisModule_LoadDefaultConfigs(RedisModuleCtx *ctx);
7437
7444
7438
- ** Available since:** unreleased
7445
+ ** Available since:** 8.0.0
7439
7446
7440
7447
Applies all default configurations for the parameters the module registered.
7441
7448
Only call this function if the module would like to make changes to the
@@ -7542,12 +7549,273 @@ Example:
7542
7549
7543
7550
const char* RedisModule_GetInternalSecret(RedisModuleCtx *ctx, size_t *len);
7544
7551
7545
- ** Available since:** unreleased
7552
+ ** Available since:** 8.0.0
7546
7553
7547
7554
Returns the internal secret of the cluster.
7548
7555
Should be used to authenticate as an internal connection to a node in the
7549
7556
cluster, and by that gain the permissions to execute internal commands.
7550
7557
7558
+ <span id =" section-config-access-api " ></span >
7559
+
7560
+ ## Config access API
7561
+
7562
+ <span id =" RedisModule_ConfigIteratorCreate " ></span >
7563
+
7564
+ ### ` RedisModule_ConfigIteratorCreate `
7565
+
7566
+ RedisModuleConfigIterator *RedisModule_ConfigIteratorCreate(RedisModuleCtx *ctx,
7567
+ const char *pattern);
7568
+
7569
+ ** Available since:** unreleased
7570
+
7571
+ Get an iterator to all configs.
7572
+ Optional ` ctx ` can be provided if use of auto-memory is desired.
7573
+ Optional ` pattern ` can be provided to filter configs by name. If ` pattern ` is
7574
+ NULL all configs will be returned.
7575
+
7576
+ The returned iterator can be used to iterate over all configs using
7577
+ [ ` RedisModule_ConfigIteratorNext() ` ] ( #RedisModule_ConfigIteratorNext ) .
7578
+
7579
+ Example usage:
7580
+ ```
7581
+ // Below is same as [`RedisModule_ConfigIteratorCreate`](#RedisModule_ConfigIteratorCreate)(ctx, NULL)
7582
+ `RedisModuleConfigIterator` *iter = [`RedisModule_ConfigIteratorCreate`](#RedisModule_ConfigIteratorCreate)(ctx, "*");
7583
+ const char *config_name = NULL;
7584
+ while ((`config_name` = [`RedisModule_ConfigIteratorNext`](#RedisModule_ConfigIteratorNext)(iter)) != NULL) {
7585
+ RedisModuleString *value = NULL;
7586
+ if (RedisModule_ConfigGet(ctx, config_name, &value) == REDISMODULE_OK) {
7587
+ // Do something with `value`...
7588
+ RedisModule_FreeString(ctx, value);
7589
+ }
7590
+ }
7591
+ [`RedisModule_ConfigIteratorRelease`](#RedisModule_ConfigIteratorRelease)(ctx, iter);
7592
+
7593
+ // Or optionally one can check the type to get the config value directly
7594
+ // via the appropriate API in case performance is of consideration
7595
+ iter = [`RedisModule_ConfigIteratorCreate`](#RedisModule_ConfigIteratorCreate)(ctx, "*");
7596
+ while ((`config_name` = [`RedisModule_ConfigIteratorNext`](#RedisModule_ConfigIteratorNext)(iter)) != NULL) {
7597
+ RedisModuleConfigType type = RedisModule_ConfigGetType(config_name);
7598
+ if (type == REDISMODULE_CONFIG_TYPE_STRING) {
7599
+ RedisModuleString *value;
7600
+ RedisModule_ConfigGet(ctx, config_name, &value);
7601
+ // Do something with `value`...
7602
+ RedisModule_FreeString(ctx, value);
7603
+ } if (type == REDISMODULE_CONFIG_TYPE_NUMERIC) {
7604
+ long long value;
7605
+ RedisModule_ConfigGetNumeric(ctx, config_name, &value);
7606
+ // Do something with `value`...
7607
+ } else if (type == REDISMODULE_CONFIG_TYPE_BOOL) {
7608
+ int value;
7609
+ RedisModule_ConfigGetBool(ctx, config_name, &value);
7610
+ // Do something with `value`...
7611
+ } else if (type == REDISMODULE_CONFIG_TYPE_ENUM) {
7612
+ RedisModuleString *value;
7613
+ RedisModule_ConfigGetEnum(ctx, config_name, &value);
7614
+ // Do something with `value`...
7615
+ RedisModule_Free(value);
7616
+ }
7617
+ }
7618
+ [`RedisModule_ConfigIteratorRelease`](#RedisModule_ConfigIteratorRelease)(ctx, iter);
7619
+ ```
7620
+
7621
+ Returns a pointer to ` RedisModuleConfigIterator ` . Unless auto-memory is enabled
7622
+ the caller is responsible for freeing the iterator using
7623
+ [ ` RedisModule_ConfigIteratorRelease() ` ] ( #RedisModule_ConfigIteratorRelease ) .
7624
+
7625
+ <span id =" RedisModule_ConfigIteratorRelease " ></span >
7626
+
7627
+ ### ` RedisModule_ConfigIteratorRelease `
7628
+
7629
+ void RedisModule_ConfigIteratorRelease(RedisModuleCtx *ctx,
7630
+ RedisModuleConfigIterator *iter);
7631
+
7632
+ ** Available since:** unreleased
7633
+
7634
+ Release the iterator returned by [ ` RedisModule_ConfigIteratorCreate() ` ] ( #RedisModule_ConfigIteratorCreate ) . If auto-memory
7635
+ is enabled and manual release is needed one must pass the same ` RedisModuleCtx `
7636
+ that was used to create the iterator.
7637
+
7638
+ <span id =" RedisModule_ConfigGetType " ></span >
7639
+
7640
+ ### ` RedisModule_ConfigGetType `
7641
+
7642
+ int RedisModule_ConfigGetType(const char *name, RedisModuleConfigType *res);
7643
+
7644
+ ** Available since:** unreleased
7645
+
7646
+ Get the type of a config as ` RedisModuleConfigType ` . One may use this in order
7647
+ to get or set the values of the config with the appropriate function if the
7648
+ generic [ ` RedisModule_ConfigGet ` ] ( #RedisModule_ConfigGet ) and [ ` RedisModule_ConfigSet ` ] ( #RedisModule_ConfigSet ) APIs are performing
7649
+ poorly.
7650
+
7651
+ Intended usage of this function is when iteration over the configs is
7652
+ performed. See [ ` RedisModule_ConfigIteratorNext() ` ] ( #RedisModule_ConfigIteratorNext ) for example usage. If setting
7653
+ or getting individual configs one can check the config type by hand in
7654
+ redis.conf (or via other sources if config is added by a module) and use the
7655
+ appropriate function without the need to call this function.
7656
+
7657
+ Explanation of config types:
7658
+ - ` REDISMODULE_CONFIG_TYPE_BOOL ` : Config is a boolean. One can use ` RedisModule_Config ` (Get/Set)Bool
7659
+ - ` REDISMODULE_CONFIG_TYPE_NUMERIC ` : Config is a numeric value. One can use ` RedisModule_Config ` (Get/Set)Numeric
7660
+ - ` REDISMODULE_CONFIG_TYPE_STRING ` : Config is a string. One can use the generic ` RedisModule_Config ` (Get/Set)
7661
+ - ` REDISMODULE_CONFIG_TYPE_ENUM ` : Config is an enum. One can use ` RedisModule_Config ` (Get/Set)Enum
7662
+
7663
+ If a config with the given name exists ` res ` is populated with its type, else
7664
+ ` REDISMODULE_ERR ` is returned.
7665
+
7666
+ <span id =" RedisModule_ConfigIteratorNext " ></span >
7667
+
7668
+ ### ` RedisModule_ConfigIteratorNext `
7669
+
7670
+ const char *RedisModule_ConfigIteratorNext(RedisModuleConfigIterator *iter);
7671
+
7672
+ ** Available since:** unreleased
7673
+
7674
+ Go to the next element of the config iterator.
7675
+
7676
+ Returns the name of the next config, or NULL if there are no more configs.
7677
+ Returned string is non-owning and thus should not be freed.
7678
+ If a pattern was provided when creating the iterator, only configs matching
7679
+ the pattern will be returned.
7680
+
7681
+ See [ ` RedisModule_ConfigIteratorCreate() ` ] ( #RedisModule_ConfigIteratorCreate ) for example usage.
7682
+
7683
+ <span id =" RedisModule_ConfigGet " ></span >
7684
+
7685
+ ### ` RedisModule_ConfigGet `
7686
+
7687
+ int RedisModule_ConfigGet(RedisModuleCtx *ctx,
7688
+ const char *name,
7689
+ RedisModuleString **res);
7690
+
7691
+ ** Available since:** unreleased
7692
+
7693
+ Get the value of a config as a string. This function can be used to get the
7694
+ value of any config, regardless of its type.
7695
+
7696
+ The string is allocated by the module and must be freed by the caller unless
7697
+ auto memory is enabled.
7698
+
7699
+ If the config does not exist, ` REDISMODULE_ERR ` is returned, else ` REDISMODULE_OK `
7700
+ is returned and ` res ` is populated with the value.
7701
+
7702
+ <span id =" RedisModule_ConfigGetBool " ></span >
7703
+
7704
+ ### ` RedisModule_ConfigGetBool `
7705
+
7706
+ int RedisModule_ConfigGetBool(RedisModuleCtx *ctx, const char *name, int *res);
7707
+
7708
+ ** Available since:** unreleased
7709
+
7710
+ Get the value of a bool config.
7711
+
7712
+ If the config does not exist or is not a bool config, ` REDISMODULE_ERR ` is
7713
+ returned, else ` REDISMODULE_OK ` is returned and ` res ` is populated with the
7714
+ value.
7715
+
7716
+ <span id =" RedisModule_ConfigGetEnum " ></span >
7717
+
7718
+ ### ` RedisModule_ConfigGetEnum `
7719
+
7720
+ int RedisModule_ConfigGetEnum(RedisModuleCtx *ctx,
7721
+ const char *name,
7722
+ RedisModuleString **res);
7723
+
7724
+ ** Available since:** unreleased
7725
+
7726
+ Get the value of an enum config.
7727
+
7728
+ If the config does not exist or is not an enum config, ` REDISMODULE_ERR ` is
7729
+ returned, else ` REDISMODULE_OK ` is returned and ` res ` is populated with the value.
7730
+ If the config has multiple arguments they are returned as a space-separated
7731
+ string.
7732
+
7733
+ <span id =" RedisModule_ConfigGetNumeric " ></span >
7734
+
7735
+ ### ` RedisModule_ConfigGetNumeric `
7736
+
7737
+ int RedisModule_ConfigGetNumeric(RedisModuleCtx *ctx,
7738
+ const char *name,
7739
+ long long *res);
7740
+
7741
+ ** Available since:** unreleased
7742
+
7743
+ Get the value of a numeric config.
7744
+
7745
+ If the config does not exist or is not a numeric config, ` REDISMODULE_ERR ` is
7746
+ returned, else ` REDISMODULE_OK ` is returned and ` res ` is populated with the
7747
+ value.
7748
+
7749
+ <span id =" RedisModule_ConfigSet " ></span >
7750
+
7751
+ ### ` RedisModule_ConfigSet `
7752
+
7753
+ int RedisModule_ConfigSet(RedisModuleCtx *ctx,
7754
+ const char *name,
7755
+ RedisModuleString *value,
7756
+ RedisModuleString **err);
7757
+
7758
+ ** Available since:** unreleased
7759
+
7760
+ Set the value of a config.
7761
+
7762
+ This function can be used to set the value of any config, regardless of its
7763
+ type. If the config is multi-argument, the value must be a space-separated
7764
+ string.
7765
+
7766
+ If the value failed to be set ` REDISMODULE_ERR ` will be returned and if ` err `
7767
+ is not NULL, it will be populated with an error message.
7768
+
7769
+ <span id =" RedisModule_ConfigSetBool " ></span >
7770
+
7771
+ ### ` RedisModule_ConfigSetBool `
7772
+
7773
+ int RedisModule_ConfigSetBool(RedisModuleCtx *ctx,
7774
+ const char *name,
7775
+ int value,
7776
+ RedisModuleString **err);
7777
+
7778
+ ** Available since:** unreleased
7779
+
7780
+ Set the value of a bool config.
7781
+
7782
+ See [ ` RedisModule_ConfigSet ` ] ( #RedisModule_ConfigSet ) for return value.
7783
+
7784
+ <span id =" RedisModule_ConfigSetEnum " ></span >
7785
+
7786
+ ### ` RedisModule_ConfigSetEnum `
7787
+
7788
+ int RedisModule_ConfigSetEnum(RedisModuleCtx *ctx,
7789
+ const char *name,
7790
+ RedisModuleString *value,
7791
+ RedisModuleString **err);
7792
+
7793
+ ** Available since:** unreleased
7794
+
7795
+ Set the value of an enum config.
7796
+
7797
+ If the config is multi-argument the value parameter must be a space-separated
7798
+ string.
7799
+
7800
+ See [ ` RedisModule_ConfigSet ` ] ( #RedisModule_ConfigSet ) for return value.
7801
+
7802
+ <span id =" RedisModule_ConfigSetNumeric " ></span >
7803
+
7804
+ ### ` RedisModule_ConfigSetNumeric `
7805
+
7806
+ int RedisModule_ConfigSetNumeric(RedisModuleCtx *ctx,
7807
+ const char *name,
7808
+ long long value,
7809
+ RedisModuleString **err);
7810
+
7811
+ ** Available since:** unreleased
7812
+
7813
+ Set the value of a numeric config.
7814
+ If the value passed is meant to be a percentage, it should be passed as a
7815
+ negative value.
7816
+
7817
+ See [ ` RedisModule_ConfigSet ` ] ( #RedisModule_ConfigSet ) for return value.
7818
+
7551
7819
<span id =" section-key-eviction-api " ></span >
7552
7820
7553
7821
## Key eviction API
@@ -7801,7 +8069,7 @@ may allocate that is not tied to a specific data type.
7801
8069
int RedisModule_RegisterDefragFunc2(RedisModuleCtx *ctx,
7802
8070
RedisModuleDefragFunc2 cb);
7803
8071
7804
- ** Available since:** unreleased
8072
+ ** Available since:** 8.0.0
7805
8073
7806
8074
Register a defrag callback for global data, i.e. anything that the module
7807
8075
may allocate that is not tied to a specific data type.
@@ -7817,7 +8085,7 @@ in and indicate that it should be called again later, or is it done (returned 0)
7817
8085
RedisModuleDefragFunc start,
7818
8086
RedisModuleDefragFunc end);
7819
8087
7820
- ** Available since:** unreleased
8088
+ ** Available since:** 8.0.0
7821
8089
7822
8090
Register a defrag callbacks that will be called when defrag operation starts and ends.
7823
8091
@@ -7914,7 +8182,7 @@ be used again.
7914
8182
7915
8183
void *RedisModule_DefragAllocRaw(RedisModuleDefragCtx *ctx, size_t size);
7916
8184
7917
- ** Available since:** unreleased
8185
+ ** Available since:** 8.0.0
7918
8186
7919
8187
Allocate memory for defrag purposes
7920
8188
@@ -7934,7 +8202,7 @@ allow to support more complex defrag usecases.
7934
8202
7935
8203
void RedisModule_DefragFreeRaw(RedisModuleDefragCtx *ctx, void *ptr);
7936
8204
7937
- ** Available since:** unreleased
8205
+ ** Available since:** 8.0.0
7938
8206
7939
8207
Free memory for defrag purposes
7940
8208
@@ -7968,7 +8236,7 @@ on the Redis side is dropped as soon as the command callback returns).
7968
8236
RedisModuleDefragDictValueCallback valueCB,
7969
8237
RedisModuleString **seekTo);
7970
8238
7971
- ** Available since:** unreleased
8239
+ ** Available since:** 8.0.0
7972
8240
7973
8241
Defragment a Redis Module Dictionary by scanning its contents and calling a value
7974
8242
callback for each value.
@@ -8061,6 +8329,18 @@ There is no guarantee that this info is always available, so this may return -1.
8061
8329
* [ ` RedisModule_CommandFilterArgReplace ` ] ( #RedisModule_CommandFilterArgReplace )
8062
8330
* [ ` RedisModule_CommandFilterArgsCount ` ] ( #RedisModule_CommandFilterArgsCount )
8063
8331
* [ ` RedisModule_CommandFilterGetClientId ` ] ( #RedisModule_CommandFilterGetClientId )
8332
+ * [ ` RedisModule_ConfigGet ` ] ( #RedisModule_ConfigGet )
8333
+ * [ ` RedisModule_ConfigGetBool ` ] ( #RedisModule_ConfigGetBool )
8334
+ * [ ` RedisModule_ConfigGetEnum ` ] ( #RedisModule_ConfigGetEnum )
8335
+ * [ ` RedisModule_ConfigGetNumeric ` ] ( #RedisModule_ConfigGetNumeric )
8336
+ * [ ` RedisModule_ConfigGetType ` ] ( #RedisModule_ConfigGetType )
8337
+ * [ ` RedisModule_ConfigIteratorCreate ` ] ( #RedisModule_ConfigIteratorCreate )
8338
+ * [ ` RedisModule_ConfigIteratorNext ` ] ( #RedisModule_ConfigIteratorNext )
8339
+ * [ ` RedisModule_ConfigIteratorRelease ` ] ( #RedisModule_ConfigIteratorRelease )
8340
+ * [ ` RedisModule_ConfigSet ` ] ( #RedisModule_ConfigSet )
8341
+ * [ ` RedisModule_ConfigSetBool ` ] ( #RedisModule_ConfigSetBool )
8342
+ * [ ` RedisModule_ConfigSetEnum ` ] ( #RedisModule_ConfigSetEnum )
8343
+ * [ ` RedisModule_ConfigSetNumeric ` ] ( #RedisModule_ConfigSetNumeric )
8064
8344
* [ ` RedisModule_CreateCommand ` ] ( #RedisModule_CreateCommand )
8065
8345
* [ ` RedisModule_CreateDataType ` ] ( #RedisModule_CreateDataType )
8066
8346
* [ ` RedisModule_CreateDict ` ] ( #RedisModule_CreateDict )
@@ -8373,4 +8653,3 @@ There is no guarantee that this info is always available, so this may return -1.
8373
8653
* [ ` RedisModule_ZsetRem ` ] ( #RedisModule_ZsetRem )
8374
8654
* [ ` RedisModule_ZsetScore ` ] ( #RedisModule_ZsetScore )
8375
8655
* [ ` RedisModule__Assert ` ] ( #RedisModule__Assert )
8376
-
0 commit comments