Sha256: be1515d6c917275f686f95d3f7a392a879046bd0ef908e0487313e1dfb4acec8

Contents?: true

Size: 795 Bytes

Versions: 23

Compression:

Stored size: 795 Bytes

Contents

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'

token = ENV.fetch("TOKEN") { abort "TOKEN environment variable not set." }
feature_name = ENV.fetch("FEATURE") { "testing" }.to_sym

Flipper.configure do |config|
  config.default do
    Flipper::Cloud.new(token) 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

23 entries across 23 versions & 1 rubygems

Version Path
flipper-cloud-0.20.1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.0.beta3 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.0.beta2 examples/cloud/cached_in_memory.rb
flipper-cloud-0.20.0.beta1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.19.1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.19.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.18.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.17.2 examples/cloud/cached_in_memory.rb
flipper-cloud-0.17.1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.16.2 examples/cloud/cached_in_memory.rb
flipper-cloud-0.16.1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.16.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.15.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.14.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.13.0 examples/cloud/cached_in_memory.rb
flipper-cloud-0.13.0.beta1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.12.2 examples/cloud/cached_in_memory.rb
flipper-cloud-0.12.1 examples/cloud/cached_in_memory.rb
flipper-cloud-0.12.0 examples/cloud/cached_in_memory.rb