From c1aaad06d85c89ab7abebd5cefab026bdcb086ab Mon Sep 17 00:00:00 2001 From: chenyangyang Date: Mon, 16 Nov 2020 16:34:04 +0800 Subject: Modules callbacks for lazy free effort, and unlink (#7912) Add two optional callbacks to the RedisModuleTypeMethods structure, which is `free_effort` and `unlink`. the `free_effort` callback indicates the effort required to free a module memory. Currently, if the effort exceeds LAZYFREE_THRESHOLD, the module memory may be released asynchronously. the `unlink` callback indicates the key has been removed from the DB by redis, and may soon be freed by a background thread. Add `lazyfreed_objects` info field, which represents the number of objects that have been lazyfreed since redis was started. Add `RM_GetTypeMethodVersion` API, which return the current redis-server runtime value of `REDISMODULE_TYPE_METHOD_VERSION`. You can use that when calling `RM_CreateDataType` to know which fields of RedisModuleTypeMethods are gonna be supported and which will be ignored. --- src/t_set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/t_set.c') diff --git a/src/t_set.c b/src/t_set.c index c1e7fddef..2cca15ae2 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -1080,7 +1080,7 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum, sdsfree(ele); } setTypeReleaseIterator(si); - server.lazyfree_lazy_server_del ? freeObjAsync(dstset) : + server.lazyfree_lazy_server_del ? freeObjAsync(NULL, dstset) : decrRefCount(dstset); } else { /* If we have a target key where to store the resulting set -- cgit v1.2.1