Class: LaunchDarkly::Impl::Integrations::Redis::RedisBigSegmentStore

Inherits:
RedisStoreImplBase show all
Defined in:
lib/ldclient-rb/impl/integrations/redis_impl.rb

Overview

Internal implementation of the Redis big segment store.

Since:

  • 5.5.0

Constant Summary collapse

KEY_LAST_UP_TO_DATE =

Since:

  • 5.5.0

':big_segments_synchronized_on'
KEY_CONTEXT_INCLUDE =

Since:

  • 5.5.0

':big_segment_include:'
KEY_CONTEXT_EXCLUDE =

Since:

  • 5.5.0

':big_segment_exclude:'

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from LaunchDarkly::Impl::Integrations::Redis::RedisStoreImplBase

Instance Method Details

#descriptionObject

Since:

  • 5.5.0



279
280
281
# File 'lib/ldclient-rb/impl/integrations/redis_impl.rb', line 279

def description
  "RedisBigSegmentStore"
end

#get_membership(context_hash) ⇒ Object

Since:

  • 5.5.0



288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/ldclient-rb/impl/integrations/redis_impl.rb', line 288

def get_membership(context_hash)
  with_connection do |redis|
    included_refs = redis.smembers(@prefix + KEY_CONTEXT_INCLUDE + context_hash)
    excluded_refs = redis.smembers(@prefix + KEY_CONTEXT_EXCLUDE + context_hash)
    if !included_refs && !excluded_refs
      nil
    else
      membership = {}
      excluded_refs.each { |ref| membership[ref] = false }
      included_refs.each { |ref| membership[ref] = true }
      membership
    end
  end
end

#get_metadataObject

Since:

  • 5.5.0



283
284
285
286
# File 'lib/ldclient-rb/impl/integrations/redis_impl.rb', line 283

def 
  value = with_connection { |redis| redis.get(@prefix + KEY_LAST_UP_TO_DATE) }
  Interfaces::BigSegmentStoreMetadata.new(value.nil? ? nil : value.to_i)
end