Sha256: 4be2b3ae645b738db6e711cc03f8beeca83a2c061e7fdbdac6512b75882bdc96

Contents?: true

Size: 792 Bytes

Versions: 6

Compression:

Stored size: 792 Bytes

Contents

module SplitIoClient
  module Cache
    module Repositories
      # Repository which forwards impressions interface to the selected adapter
      class MetricsRepository < Repository
        extend Forwardable
        def_delegators :@adapter, :add_count, :add_latency, :add_gauge, :counts, :latencies, :gauges,
                       :clear_counts, :clear_latencies, :clear_gauges

        def initialize(adapter, config)
          @adapter = case adapter.class.to_s
          when 'SplitIoClient::Cache::Adapters::MemoryAdapter'
            Repositories::Metrics::MemoryRepository.new(adapter, config)
          when 'SplitIoClient::Cache::Adapters::RedisAdapter'
            Repositories::Metrics::RedisRepository.new(adapter, config)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
splitclient-rb-3.1.2 lib/cache/repositories/metrics_repository.rb
splitclient-rb-3.1.1 lib/cache/repositories/metrics_repository.rb
splitclient-rb-3.1.0 lib/cache/repositories/metrics_repository.rb
splitclient-rb-3.1.0.pre.rc12 lib/cache/repositories/metrics_repository.rb
splitclient-rb-3.1.0.pre.rc11 lib/cache/repositories/metrics_repository.rb
splitclient-rb-3.1.0.pre.rc10 lib/cache/repositories/metrics_repository.rb