Module: AnyCache::Drivers Private

Defined in:
lib/any_cache/drivers.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

Defined Under Namespace

Modules: ActiveSupportDalliStore, ActiveSupportFileStore, ActiveSupportMemCacheStore, ActiveSupportMemoryStore, ActiveSupportRedisCacheStore, Dalli, Redis, RedisStore

Class Method Summary collapse

Class Method Details

.build(config) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/AbcSize

Parameters:

  • config (Qonfig::DataSet)

Returns:

  • (Object)

Raises:

Since:

  • 0.2.0



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/any_cache/drivers.rb', line 24

def build(config)
  driver = config[:driver]

  case driver
  when :redis
    Redis.build(config[:redis])
  when :redis_store
    RedisStore.build(config[:redis_store])
  when :dalli
    Dalli.build(config[:dalli])
  when :as_file_store
    ActiveSupportFileStore.build(config[:as_file_store])
  when :as_memory_store
    ActiveSupportMemoryStore.build(config[:as_memory_store])
  when :as_redis_cache_store
    ActiveSupportRedisCacheStore.build(config[:as_redis_cache_store])
  when :as_mem_cache_store
    ActiveSupportMemCacheStore.build(config[:as_mem_cache_store])
  when :as_dalli_store
    ActiveSupportDalliStore.build(config[:as_dalli_store])
  else
    raise AnyCache::UnsupportedDriverError
  end
end