diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /lib/feature | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'lib/feature')
-rw-r--r-- | lib/feature/active_support_cache_store_adapter.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/feature/active_support_cache_store_adapter.rb b/lib/feature/active_support_cache_store_adapter.rb new file mode 100644 index 00000000000..ae2d623abe1 --- /dev/null +++ b/lib/feature/active_support_cache_store_adapter.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# rubocop:disable Gitlab/NamespacedClass +# This class was already nested this way before moving to a separate file +class Feature + class ActiveSupportCacheStoreAdapter < Flipper::Adapters::ActiveSupportCacheStore + def enable(feature, gate, thing) + result = @adapter.enable(feature, gate, thing) + @cache.write(key_for(feature.key), @adapter.get(feature), @write_options) + result + end + + def disable(feature, gate, thing) + result = @adapter.disable(feature, gate, thing) + @cache.write(key_for(feature.key), @adapter.get(feature), @write_options) + result + end + + def remove(feature) + result = @adapter.remove(feature) + @cache.delete(FeaturesKey) + @cache.write(key_for(feature.key), {}, @write_options) + result + end + end +end +# rubocop:disable Gitlab/NamespacedClass |