This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Image Server for our CDN RedisGears Example | |
| """ | |
| from wand.image import Image | |
| def convert_to_format( image_binary, fmt ): | |
| converted_bin = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int ListExtendFilter_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, | |
| int argc) { | |
| // LIST_EXTEND.FILTER source_list destination_list low_value high_value | |
| if (argc != 5) { | |
| return RedisModule_WrongArity(ctx); | |
| } | |
| RedisModule_AutoMemory(ctx); | |
| // Open field/value list keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { | |
| if (RedisModule_Init(ctx, "list_extend", 1, REDISMODULE_APIVER_1) == REDISMODULE_ERR) | |
| return REDISMODULE_ERR; | |
| // "write": The command may modify the data set (it may also read from it). | |
| // "deny-oom": The command may use additional memory and should be denied during out of memory conditions. | |
| if (RedisModule_CreateCommand(ctx, "list_extend.filter", ListExtendFilter_RedisCommand, "write deny-oom", 1, 1, 1) == REDISMODULE_ERR) | |
| return REDISMODULE_ERR; | |
| return REDISMODULE_OK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /************************************************************************* | |
| * | |
| * Redis 5.X under the hood: 3 - Writing a Redis Module | |
| * ____________________________________________________ | |
| * | |
| * [2019] @fcosta_oliveira | |
| * | |
| */ | |
| #include "redismodule.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # snippet from https://github.com/redis-porto/redistimeseries-airquality/blob/master/plot.py | |
| #(...) | |
| #(...) | |
| # redis setup | |
| redis_obj = redis.Redis(host=args.host, port=args.port, password=args.password) | |
| temperature_key = "ts:temperature" | |
| temperature_description = "Temperature in °C variation" | |
| temperature_y_label = "°C" | |
| carbon_monoxide_key = "ts:carbon_monoxide" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # snippet from https://github.com/redis-porto/redistimeseries-airquality/blob/master/dataloader.py | |
| #(...) | |
| #(...) | |
| # redis setup | |
| redis_obj = redis.Redis(host=args.host, port=args.port, password=args.password) | |
| temperature_key = "ts:temperature" | |
| carbon_monoxide_key = "ts:carbon_monoxide" | |
| relative_humidity_key = "ts:relative_humidity" | |
| with open(args.csv, newline="") as csv_file: |
NewerOlder