Sha256: 7a0e7f041bf844ba69ba159001ff1b68358292842a21cf405c45f54160f91020
Contents?: true
Size: 1.14 KB
Versions: 29
Compression:
Stored size: 1.14 KB
Contents
module SplitIoClient module Cache module Repositories # Repository which forwards events interface to the selected adapter class EventsRepository < Repository extend Forwardable def_delegators :@adapter, :add, :clear def initialize(adapter, config) @config = config @adapter = case adapter.class.to_s when 'SplitIoClient::Cache::Adapters::MemoryAdapter' Repositories::Events::MemoryRepository.new(adapter, config) when 'SplitIoClient::Cache::Adapters::RedisAdapter' Repositories::Events::RedisRepository.new(adapter, config) end end protected def metadata { s: "#{@config.language}-#{@config.version}", i: @config.machine_ip, n: @config.machine_name } end def event(key, traffic_type, event_type, time, value) { key: key, trafficTypeName: traffic_type, eventTypeId: event_type, value: value, timestamp: time }.reject { |_, v| v.nil? } end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems