Package goredis is another redis client with full features which writter in golang Protocol Specification: http://redis.io/topics/protocol. Redis reply has five types: status, error, integer, bulk, multi bulk. A Status Reply is in the form of a single line string starting with "+" terminated by "\r\n". Error Replies are very similar to Status Replies. The only difference is that the first byte is "-". Integer reply is just a CRLF terminated string representing an integer, prefixed by a ":" byte. Bulk replies are used by the server in order to return a single binary safe string up to 512 MB in length. A Multi bulk reply is used to return an array of other replies. Every element of a Multi Bulk Reply can be of any kind, including a nested Multi Bulk Reply. So five reply type is defined: And then a Reply struct which represent the redis response data is defined: Reply struct has many useful methods: Connect redis has two function: Dial and DialURL, for example: DialConfig can also take named options for connection config: Try a redis command is simple too, let's do GET/SET: Or you can execute customer command with Redis.ExecuteCommand method: Redis Pipelining is defined as: Transaction, Lua Eval, Publish/Subscribe, Monitor, Scan, Sort are also supported.
Package redis is a redis backed store implementation
This example shows how to cache service principal authentication data persistently to make it accessible to multiple processes. The example uses ClientCertificateCredential, however the pattern is the same for all service principal credential types having a Cache field in their options. The key steps are: Credentials that authenticate users such as InteractiveBrowserCredential have a different pattern; see the persistent user authentication example. This example shows how to cache authentication data persistently so a user doesn't need to authenticate interactively every time the application runs. The example uses InteractiveBrowserCredential, however DeviceCodeCredential has the same API. The key steps are: This examples applies to credentials that authenticate users. For credentials authenticating service principal, see the persistent service principal authentication example. This example demonstrates how to use azidentity to authenticate a go-redis client connecting to Azure Cache for Redis. See the Azure Cache for Redis documentation for information on configuring a cache to use Entra ID authentication.
Package redisqueue provides a producer and consumer of a queue that uses Redis streams (https://redis.io/topics/streams-intro). The features of this package include: Here's an example of a producer that inserts 1000 messages into a queue: And here's an example of a consumer that reads the messages off of that queue:
Package redsync provides a Redis-based distributed mutual exclusion lock implementation as described in the post http://redis.io/topics/distlock. Values containing the types defined in this package should not be copied.
Package redismock is useful for unit testing applications that interact with Redis. The two constructors NewMock and NewNiceMock are explained in more detail on the functions themselves.
Package asynq provides a framework for Redis based distrubted task queue. Asynq uses Redis as a message broker. To connect to redis, specify the connection using one of RedisConnOpt types. The Client is used to enqueue a task. The Server is used to run the task processing workers with a given handler. Handler is an interface type with a method which takes a task and returns an error. Handler should return nil if the processing is successful, otherwise return a non-nil error. If handler panics or returns a non-nil error, the task will be retried in the future. Example of a type that implements the Handler interface.
Package goredis is a client for the redis and ledisdb. The client is the primary interface for redis. You must first create a client with redis address for working. The most important function for client is Do function to send commands to remote server. You can use an independent connection to send commands. You can use reply helper to convert a reply to a specific type.
Package redsync provides a Redis-based distributed mutual exclusion lock implementation as described in the post http://redis.io/topics/distlock. Values containing the types defined in this package should not be copied.
Package redis only exists to register the redis extension