View Source GuardianRedis.Redix (GuardianRedis v0.2.0)

Redix module.

Configuration

Configuration options are the same as in Redix.start_link/1, except for pool_size, name_prefix, and name.

  • pool_size - determines how many Redix connections are created; defaults to 1
  • name_prefix - the prefix used in name; defaults to "guardian_redis"

The name option is overwritten based on the given name_prefix and pool_size. In the case of the example below, name would be :g_redis_0 for the first Redis connection, and :g_redis_1 for the second.

config :guardian_redis, :redis,
  host: "127.0.0.1",
  port: 6379,
  pool_size: 2,
  name_prefix: "g_redis"

Summary

Functions

Specs for the Redix connections.

Redis commands execution via pool of Redix workers command_params - List of String commands, e.g. ["GET", "redis_key"]

Functions

Specs for the Redix connections.

@spec command(command_params :: [any()]) ::
  {:ok, Redix.Protocol.redis_value()}
  | {:error, atom() | Redix.Error.t() | Redix.ConnectionError.t()}

Redis commands execution via pool of Redix workers command_params - List of String commands, e.g. ["GET", "redis_key"]

Examples

iex> GuardianRedis.Redix.command(["SET", "key", "value"])
{:ok, "OK"}
iex> GuardianRedis.Redix.command(["GET", "key"])
{:ok, "value"}