Charon.SessionStore.RedisStore.Migrate (Charon v4.2.0)

View Source

Migrate Redis data older to newer data formats.

Summary

Functions

Migrate Redis data from the v3 data format to the v4 data format. This function is idempotent.

Types

migrate_opt()

@type migrate_opt() ::
  {:batch_size, pos_integer()} | {:sessions_per_user, pos_integer()}

migrate_opts()

@type migrate_opts() :: [migrate_opt()]

Functions

migrate_v3_to_v4!(config, opts \\ [])

@spec migrate_v3_to_v4!(Charon.Config.t(), migrate_opts()) :: %{
  count: integer(),
  failed: integer()
}

Migrate Redis data from the v3 data format to the v4 data format. This function is idempotent.

This is a (relatively) slow operation that iterates keys in the instance and does not guarantee atomicity. The function IS atomic for each batch, i.e. not all data may be migrated if new sessions are created during a migration run, but users whose sessions ARE migrated, are migrated completely. Regardless, it is recommended that this function is executed during a maintenance window.

Options

  • :batch_size (default 200) number of sessions sets (sessions of a single user) to be read in one batch
  • :sessions_per_user (default 5) estimation of the maximum average number of sessions per user - used to balance reads and writes