Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

GodotRedisClient

An asset by shiburito
The page banner background of a mountain and forest
GodotRedisClient hero image

Quick Information

0 ratings
GodotRedisClient icon image
shiburito
GodotRedisClient

This is a simple redis client for use in GDScript. This implements the redis protocol found herehttps://redis.io/docs/latest/develop/reference/protocol-specTested on latest stable Godot

Supported Engine Version
4.0
Version String
0.0.2
License Version
MIT
Support Level
community
Modified Date
5 hours ago
Git URL
Issue URL

Godot Redis Client

See the examples folder for full up-to-date implementation. You can run the example scene which will default to a local redis instance.

I found the need for a simple redis client when needing to persist state of backend software so I created this. This was largly built off of reading Redis serialization protocol specification

Basic Usage

  • var redis : RedisClient = RedisClient.new() as RedisClient - Initialize the client, can pass in host, port and timeouts
  • var connected = await redis.connect_to_redis() - Starts the actual connection to the redis client
  • var auth_connected = await redis.connect_to_redis({"user": "test", "pass": "test123"}) - Connect with authentication info
  • await redis.setex("test_key", "Initial Value", 60) - Set a value with an expiry(seconds)
  • await redis.set_value("test_key", "New Initial Value") - Sets a value without an expiry
  • var value = await redis.get_value("test_key") - Get a value
  • await redis.hset("user:100", "score", "500") - Set a singular hash key/value
  • var user_data = await redis.hgetall("user:100") - Fetch a hash value
  • await redis.hset_multi("user:100", { "name": "Jim", "score": "1000", "some_new_field": "WOOOO" }) - Set a key to a whole hash at once
  • var count = await redis.publish("updates", "Data was modified") print("Published message to %d subscribers" % count) - Publish a message on a channel

Signals

There are various signals available from the client. These are generally for Pub/Sub operations.

  • signal message_received(channel: String, message: String)
  • signal pattern_message_received(pattern: String, channel: String, message: String)
  • signal subscribed(channel: String, subscription_count: int)
  • signal unsubscribed(channel: String, subscription_count: int)
  • signal pattern_subscribed(pattern: String, subscription_count: int)
  • signal pattern_unsubscribed(pattern: String, subscription_count: int)

This is a simple redis client for use in GDScript. This implements the redis protocol found here
https://redis.io/docs/latest/develop/reference/protocol-spec

Tested on latest stable Godot

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
GodotRedisClient icon image
shiburito
GodotRedisClient

This is a simple redis client for use in GDScript. This implements the redis protocol found herehttps://redis.io/docs/latest/develop/reference/protocol-specTested on latest stable Godot

Supported Engine Version
4.0
Version String
0.0.2
License Version
MIT
Support Level
community
Modified Date
5 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers