Module: AnyCache::Adapters Private

Defined in:
lib/any_cache/adapters.rb,
lib/any_cache/adapters/basic.rb,
lib/any_cache/adapters/dalli.rb,
lib/any_cache/adapters/redis.rb,
lib/any_cache/adapters/delegator.rb,
lib/any_cache/adapters/redis_store.rb,
lib/any_cache/adapters/active_support_file_store.rb,
lib/any_cache/adapters/active_support_dalli_store.rb,
lib/any_cache/adapters/active_support_naive_store.rb,
lib/any_cache/adapters/active_support_memory_store.rb,
lib/any_cache/adapters/active_support_mem_cache_store.rb,
lib/any_cache/adapters/active_support_file_store/expire.rb,
lib/any_cache/adapters/active_support_redis_cache_store.rb,
lib/any_cache/adapters/active_support_file_store/persist.rb,
lib/any_cache/adapters/active_support_memory_store/expire.rb,
lib/any_cache/adapters/active_support_file_store/decrement.rb,
lib/any_cache/adapters/active_support_file_store/increment.rb,
lib/any_cache/adapters/active_support_file_store/operation.rb,
lib/any_cache/adapters/active_support_memory_store/persist.rb,
lib/any_cache/adapters/active_support_memory_store/decrement.rb,
lib/any_cache/adapters/active_support_memory_store/increment.rb,
lib/any_cache/adapters/active_support_memory_store/operation.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.1.0

Defined Under Namespace

Classes: ActiveSupportDalliStore, ActiveSupportFileStore, ActiveSupportMemCacheStore, ActiveSupportMemoryStore, ActiveSupportNaiveStore, ActiveSupportRedisCacheStore, Basic, Dalli, Delegator, Redis, RedisStore

Class Method Summary collapse

Class Method Details

.build(driver) ⇒ AnyCache::Adapters::Basic

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/LineLength, Metrics/AbcSize

Parameters:

  • driver (Object)

Returns:

Raises:

Since:

  • 0.1.0



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/any_cache/adapters.rb', line 27

def build(driver)
  case
  when RedisStore.supported_driver?(driver)                   then RedisStore.new(driver)
  when Redis.supported_driver?(driver)                        then Redis.new(driver)
  when Dalli.supported_driver?(driver)                        then Dalli.new(driver)
  when ActiveSupportRedisCacheStore.supported_driver?(driver) then ActiveSupportRedisCacheStore.new(driver)
  when ActiveSupportMemoryStore.supported_driver?(driver)     then ActiveSupportMemoryStore.new(driver)
  when ActiveSupportFileStore.supported_driver?(driver)       then ActiveSupportFileStore.new(driver)
  when ActiveSupportMemCacheStore.supported_driver?(driver)   then ActiveSupportMemCacheStore.new(driver)
  when ActiveSupportDalliStore.supported_driver?(driver)      then ActiveSupportDalliStore.new(driver)
  when Delegator.supported_driver?(driver)                    then Delegator.new(driver)
  else
    raise AnyCache::UnsupportedDriverError
  end
end