Sha256: 477923740d7046c138b479c15a47c683c0154a41a57affab24575db15f0a2429

Contents?: true

Size: 944 Bytes

Versions: 272

Compression:

Stored size: 944 Bytes

Contents

module SplitIoClient
  module Cache
    module Repositories
      module Events
        class RedisRepository < EventsRepository

          def initialize(config)
            @config = config
            @adapter = @config.events_adapter
          end

          def add(key, traffic_type, event_type, time, value, properties, size)
            @adapter.add_to_queue(
              namespace_key('.events'),
              { m: metadata, e: event(key, traffic_type, event_type, time, value, properties) }.to_json
            )
          end

          def clear
            @adapter.get_from_queue(namespace_key('.events'), 0).map do |e|
              JSON.parse(e, symbolize_names: true)
            end
          rescue StandardError => e
            @config.logger.error("Exception while clearing events cache: #{e}")
            []
          end

          def batch
            clear()
          end
        end
      end
    end
  end
end

Version data entries

272 entries across 272 versions & 1 rubygems

Version Path
splitclient-rb-7.3.3-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc18-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc18 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc17-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc17 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc16-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc16 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc15-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc15 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc14-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc14 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc13-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc13 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc12-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc12 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc11-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc11 lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc10-java lib/splitclient-rb/cache/repositories/events/redis_repository.rb
splitclient-rb-7.3.3.pre.rc10 lib/splitclient-rb/cache/repositories/events/redis_repository.rb