Class: Twelvefactor::Environment::Cache::Dalli

Inherits:
Object
  • Object
show all
Defined in:
lib/twelvefactor/environment/cache/dalli.rb

Class Method Summary collapse

Class Method Details

.apply(app, cache_url) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/twelvefactor/environment/cache/dalli.rb', line 3

def self.apply app, cache_url
  config = app.config

  config.cache_store = [
    :dalli_store,
    cache_url.host.split(","),
    options(cache_url.query)
  ]
end

.options(query) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/twelvefactor/environment/cache/dalli.rb', line 13

def self.options query
  return {} unless query

  CGI
    .parse(query)
    .map { |k, val| [k.to_sym, val.first] }
    .to_h
end