1
0
Fork 0
forked from fun/fun

Added a Redis/Valkey extension named redis. (0.42.0)

This commit is contained in:
Johannes Findeisen 2026-06-03 21:48:45 +02:00
commit cbb81c0b93
28 changed files with 798 additions and 15 deletions

View file

@ -0,0 +1,29 @@
Redis extension examples (hiredis)
This folder contains small Fun scripts that demonstrate how to use the Redis extension.
Prerequisites
- Build Fun with Redis support enabled (FUN_WITH_REDIS=ON). This is ON by default in cmake/Extensions/REDIS.cmake.
- A Redis-compatible server reachable at 127.0.0.1:6379.
How to run
- Using the Fun CLI from the repository root:
- Debug profile path: build_debug/fun
- Release profile path: build_release/fun
Examples
1. basic_ping.fun
- Connects, PINGs, then closes.
2. kv_set_get.fun
- SET/GET, EXISTS and DEL for a demo key.
3. list_ops.fun
- Demonstrates LPUSH and LRANGE on a list.
4. hash_ops.fun
- Demonstrates HSET, HGET and HGETALL on a hash.
Note
- All examples use direct inline command strings with redis_cmd(handle, "COMMAND args...").
- Close the connection with redis_close(handle) when finished.