class Twelvefactor::Environment::Cache::Dalli

Public Class Methods

apply(app, cache_url) click to toggle source
# 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) click to toggle source
# 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