-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from 0exp/feature/configuration-layer
[gem] Configuration layer
- Loading branch information
Showing
26 changed files
with
490 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
## [Unreleased] | ||
- configuration layer `AnyCache.configure`: an ability to choose and configure a necessary cache client | ||
without any explicit client object instantiation (client object will be instantiated implicitly); | ||
|
||
## [0.1.0] - 2018-08-26 | ||
- Release :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
# @api private | ||
# @since 0.2.0 | ||
module AnyCache::Drivers | ||
require_relative 'drivers/dalli' | ||
require_relative 'drivers/redis' | ||
require_relative 'drivers/redis_store' | ||
require_relative 'drivers/active_support_file_store' | ||
require_relative 'drivers/active_support_memory_store' | ||
require_relative 'drivers/active_support_redis_cache_store' | ||
|
||
class << self | ||
# @param config [Qonfig::DataSet] | ||
# @return [Object] | ||
# | ||
# @raise [AnyCache::UnsupportedDriverError] | ||
# | ||
# @api private | ||
# @since 0.2.0 | ||
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]) | ||
else | ||
raise AnyCache::UnsupportedDriverError | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.