gitlab-org--gitlab-foss/config/initializers/flipper.rb
Yorick Peterse ef99a3c8bc
Increase feature flag cache TTL to one hour
Flipper already takes care of flushing cache entries when
enabling/disabling features so it should be safe to increase the TTL.
This in turn should drastically reduce the number of Flipper queries
executed.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/40854
2018-02-19 14:28:22 +01:00

22 lines
622 B
Ruby

require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store'
Flipper.configure do |config|
config.default do
adapter = Flipper::Adapters::ActiveRecord.new(
feature_class: Feature::FlipperFeature, gate_class: Feature::FlipperGate)
cached_adapter = Flipper::Adapters::ActiveSupportCacheStore.new(
adapter,
Rails.cache,
expires_in: 1.hour)
Flipper.new(cached_adapter)
end
end
Feature.register_feature_groups
unless Rails.env.test?
require 'flipper/middleware/memoizer'
Rails.application.config.middleware.use Flipper::Middleware::Memoizer
end