summaryrefslogtreecommitdiff
path: root/lib/feature
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /lib/feature
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-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.rb27
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