Class: SplitIoClient::Cache::Repositories::RedisFlagSetsRepository
- Inherits:
-
SplitIoClient::Cache::Repository
- Object
- SplitIoClient::Cache::Repository
- SplitIoClient::Cache::Repositories::RedisFlagSetsRepository
- Defined in:
- lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb
Instance Method Summary collapse
- #add_feature_flag_to_flag_set(flag_set, feature_flag) ⇒ Object
- #add_flag_set(flag_set) ⇒ Object
- #flag_set_exist?(flag_set) ⇒ Boolean
- #get_flag_sets(flag_sets) ⇒ Object
-
#initialize(config) ⇒ RedisFlagSetsRepository
constructor
A new instance of RedisFlagSetsRepository.
- #remove_feature_flag_from_flag_set(flag_set, feature_flag) ⇒ Object
- #remove_flag_set(flag_set) ⇒ Object
Methods inherited from SplitIoClient::Cache::Repository
Constructor Details
#initialize(config) ⇒ RedisFlagSetsRepository
Returns a new instance of RedisFlagSetsRepository.
8 9 10 11 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 8 def initialize(config) super(config) @adapter = SplitIoClient::Cache::Adapters::RedisAdapter.new(@config.redis_url) end |
Instance Method Details
#add_feature_flag_to_flag_set(flag_set, feature_flag) ⇒ Object
38 39 40 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 38 def add_feature_flag_to_flag_set(flag_set, feature_flag) # not implemented end |
#add_flag_set(flag_set) ⇒ Object
30 31 32 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 30 def add_flag_set(flag_set) # not implemented end |
#flag_set_exist?(flag_set) ⇒ Boolean
13 14 15 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 13 def flag_set_exist?(flag_set) @adapter.exists?(namespace_key(".flagSet.#{flag_set}")) end |
#get_flag_sets(flag_sets) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 17 def get_flag_sets(flag_sets) result = @adapter.redis.pipelined do |pipeline| flag_sets.each do |flag_set| pipeline.smembers(namespace_key(".flagSet.#{flag_set}")) end end to_return = Array.new result.each do |flag_set| flag_set.each { |feature_flag_name| to_return.push(feature_flag_name.to_s)} end to_return.uniq end |
#remove_feature_flag_from_flag_set(flag_set, feature_flag) ⇒ Object
42 43 44 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 42 def remove_feature_flag_from_flag_set(flag_set, feature_flag) # not implemented end |
#remove_flag_set(flag_set) ⇒ Object
34 35 36 |
# File 'lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb', line 34 def remove_flag_set(flag_set) # not implemented end |