module Gitlab
This cache strategy is an implementation on top of the redis hash data type, that also adheres to the ActiveSupport::Cache::Store interface. It's a good example of how to build a custom caching strategy for Gitlab::Experiment
, and is intended to be a long lived cache – until the experiment is cleaned up.
The data structure:
key: experiment.name fields: context key => variant name
Gitlab::Experiment::Configuration.cache
= Gitlab::Experiment::Cache::RedisHashStore.new(
pool: -> { Gitlab::Redis::SharedState.with { |redis| yield redis } }
)