Adapters
Flipper is built on adapters for maximum flexibility. Regardless of what data store you are using, Flipper can performantly store data in it. Storage adapters are local to your application, so you'll have blazing fast feature checks that are always in sync and available, even if Flipper Cloud isn't for some reason.
Officially Supported
Pick one of our supported adapters and follow the installation instructions:
- ActiveRecord
- Sequel
- Redis
- Mongo
- Moneta - great for a variety of data stores
- Rollout - great for switching from rollout to flipper
- Memory – great for tests
- PStore – great for when a local file is enough
-
Http - great for using with
Flipper::Api
- ActiveSupportCacheStore - great for Rails caching
- Read-only - great for preventing writes from production console
- Failsafe - fails safely when an exception is raised
Create a new adapter
Don't see an adapter that suits your needs? You can create your own. We even provide automatic (rspec and minitest) tests for you, so you know you've built your custom adapter correctly.
Swapping Adapters
If you find yourself using one adapter and would like to swap to another, you can do that! Flipper adapters support importing another adapter's data. This will wipe the adapter you are wanting to swap to, if it isn't already clean, so please be careful.
# Say you are using redis...
redis_adapter = Flipper::Adapters::Redis.new(Redis.new)
redis_flipper = Flipper.new(redis_adapter)
# And redis has some stuff enabled...
redis_flipper.enable(:search)
redis_flipper.enable_percentage_of_time(:verbose_logging, 5)
redis_flipper.enable_percentage_of_actors(:new_feature, 5)
redis_flipper.enable_actor(:issues, Flipper::Actor.new('1'))
redis_flipper.enable_actor(:issues, Flipper::Actor.new('2'))
redis_flipper.enable_group(:request_tracing, :staff)
# And you would like to switch to active record...
ar_adapter = Flipper::Adapters::ActiveRecord.new
ar_flipper = Flipper.new(ar_adapter)
# NOTE: This wipes active record clean and copies features/gates from redis into active record.
ar_flipper.import(redis_flipper)
# active record is now identical to redis.
ar_flipper.features.each do |feature|
pp feature: feature.key, values: feature.gate_values
end