Module: Rack::AcornCache::Storage
- Defined in:
- lib/acorn_cache/storage.rb
Class Method Summary collapse
Class Method Details
.memcached ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/acorn_cache/storage.rb', line 16 def self.memcached = {} if ENV["ACORNCACHE_MEMCACHED_USERNAME"] = { username: ENV["ACORNCACHE_MEMCACHED_USERNAME"], password: ENV["ACORNCACHE_MEMCACHED_PASSWORD"] } end @memcached ||= Dalli::Client.new(ENV["ACORNCACHE_MEMCACHED_URL"], ) end |
.redis ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/acorn_cache/storage.rb', line 6 def self.redis args = { host: ENV["ACORNCACHE_REDIS_HOST"], port: ENV["ACORNCACHE_REDIS_PORT"].to_i } if ENV["ACORNCACHE_REDIS_PASSWORD"] args.merge!(password: ENV["ACORNCACHE_REDIS_PASSWORD"]) end @redis ||= Redis.new(args) end |