View Source Charon.SessionStore.RedisStore (Charon v1.3.4)

A persistent session store based on Redis, which implements behaviour Charon.SessionStore. In addition to the required callbacks, this store also provides get_all/2 and delete_all/2 (for a user) functions.

config

Config

Additional config is required for this module (see Charon.SessionStore.RedisStore.Config):

Charon.Config.from_enum(
  ...,
  optional_modules: %{
    Charon.SessionStore.RedisStore => %{
      redix_module: MyApp.Redix,
      key_prefix: "charon_"
    }
  }
)

The following options are supported:

  • :redix_module (required). A module that implements a command/1 and a pipeline/1 function for Redis commands like Redix.
  • :key_prefix (optional). A string prefix for the Redis keys that are sessions.

redix

Redix

This module depends on a correctly configured Redix module with command/1 and pipeline/1 functions. See https://hexdocs.pm/redix for instructions.

cleanup

Cleanup

Session keys slowly accumulate in Redis when using this store. It provides a cleanup/1 that should run periodically.

Link to this section Summary

Functions

This should run periodically, for example once per day at a quiet moment.

Link to this section Functions

@spec cleanup(Charon.Config.t()) :: :ok | {:error, binary()}

This should run periodically, for example once per day at a quiet moment.