module AnyCache::Adapters

@api private @since 0.1.0

Public Class Methods

build(driver) click to toggle source

@param driver [Object] @return [AnyCache::Adapters::Basic]

@raise [AnyCache::UnsupportedDriverError]

@api private @since 0.1.0 rubocop:disable Metrics/LineLength, Metrics/AbcSize

# 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