Sha256: bff86e16bb5ac135ea426e7c70ef90952d646e5d73362a8ff7e504a6f1fa6f60

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

# env FLIPPER_CLOUD_TOKEN=<token> bundle exec ruby examples/cloud/cached_in_memory.rb
require File.expand_path('../../example_setup', __FILE__)

require 'flipper/cloud'
require 'flipper/adapters/active_support_cache_store'
require 'active_support/cache'
require 'active_support/cache/memory_store'

feature_name = ENV.fetch("FEATURE") { "testing" }.to_sym

Flipper.configure do |config|
  config.default do
    Flipper::Cloud.new do |cloud|
      cloud.debug_output = STDOUT
      cloud.adapter do |adapter|
        Flipper::Adapters::ActiveSupportCacheStore.new(adapter,
          ActiveSupport::Cache::MemoryStore.new, {expires_in: 5.seconds})
      end
    end
  end
end

loop do
  # Should only print out http call every 5 seconds
  p Flipper.enabled?(feature_name)
  puts "\n\n"

  sleep 1
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flipper-cloud-0.20.4 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.3 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.2 examples/cloud/cached_in_memory.rb