https://github.com/pmeinhardt/redis-functions
Tiny modules for extending Redis
https://github.com/pmeinhardt/redis-functions
colors functions leaderboard more ranking redis
Last synced: about 2 months ago
JSON representation
Tiny modules for extending Redis
- Host: GitHub
- URL: https://github.com/pmeinhardt/redis-functions
- Owner: pmeinhardt
- License: mit
- Created: 2023-01-29T13:50:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-14T01:37:08.000Z (over 3 years ago)
- Last Synced: 2025-10-30T01:41:50.675Z (8 months ago)
- Topics: colors, functions, leaderboard, more, ranking, redis
- Language: Lua
- Homepage:
- Size: 34.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Redis Functions
[](https://github.com/pmeinhardt/redis-functions/actions/workflows/luacheck.yml) [](https://github.com/pmeinhardt/redis-functions/actions/workflows/tests.yml)
A collection of modules to extend [Redis](https://redis.io/) with additional functions.
## Usage
To load functions bundled in a module, run:
```sh
cat module.lua | redis-cli -x FUNCTION LOAD REPLACE
```
To list available functions:
```sh
redis-cli FUNCTION LIST [LIBRARYNAME library-name-pattern]
```
To invoke a function:
```sh
redis-cli FCALL function-name number-of-keys [key ...] [arg ...]
```
Example:
```sh
cat modules/hello.lua | redis-cli -x FUNCTION LOAD REPLACE
redis-cli FCALL hello 0
# "Hello, World!"
redis-cli FCALL hello 0 Redis
# "Hello, Redis!"
```
For more information on function-related commands, check out the official Redis [docs](https://redis.io/commands/?group=scripting).
## Background
Redis supports persisted and replicated custom [functions](https://redis.io/docs/manual/programmability/functions-intro/) in versions 7.0 and newer. Functions are useful for maintaining a consistent view onto your data through a logical schema. They are (at present) written in [Lua](https://www.lua.org/), using Redis’ [Lua API](https://redis.io/docs/manual/programmability/lua-api/).
If you are tied to an older version of Redis, you might still be able to re-use code from these modules via Redis [scripting](https://redis.io/docs/manual/programmability/eval-intro/).
If you need low-level access or more fine-grained control, take a look at the Redis [Modules API](https://redis.io/docs/reference/modules/).