Name | Redis |
Syntax | redis [id:<ID>] [connect:<host> (auth:<secret>) (port:<port>/{6379}) (ssl:true/{false})/disconnect/subscribe:<channel>|.../unsubscribe/publish:<channel> message:<message>/command:<command> (args:<arg>|...)] |
Short Description | Interacts with a Redis server. |
Full Description | This command is used to interact with a redis server. It can run any standard redis commands as well as subscribe for pub/sub redis channel notifications.
Redis is a simple key/value data store that is typically used for caching and sending data between servers. The redis server runs in memory, meaning requests are insanely fast. If you run redis locally, you can expect responses to take under a millisecond. It is normally advised to run commands as ~waitable (see ~waitable), but because of the usual fast responses when the server is on localhost, you can also run commands without ~waiting. When running commands, make sure to escape unpredictable values such as player input. Alternatively, include the main redis command as the 'command' input and further arguments as a ListTag input for 'args'. This command supports subscribing to pub/sub redis channels. This allows you to listen to published messages to redis from any source, including other servers. When you subscribe to a channel, matching messages sent to the channel will trigger the redis pubsub message event. Connections that are subscribed to channels get tied up listening for messages and are unavailable to run redis commands. The channels you subscribe to support wildcard (*) matchers and other patterns, defined by the redis docs: https://redis.io/commands/psubscribe Note: Make sure there are at least a few ticks between opening a subscription and closing it, otherwise strange behavior will occur. You can publish messages to listening subscribers via publish:<channel> message:<message>. Note that this has to be done on a separate redis connection if it is already subscribed. Saving the result of this call returns the number of connected subscribers the message was sent to. The redis command is merely a wrapper, and further usage details should be gathered from an official redis command reference rather than from Denizen command help. You can view the official redis documentation and the supported commands here: https://redis.io/ |
Related Tags | <entry[saveName].result> returns an ElementTag or ListTag of the results of your command, depending on the redis command you ran.
<util.redis_connections> Returns a list of all Redis connections opened by redis.
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Group | core |
Source | https://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/scripts/commands/core/RedisCommand.java#L25 |