Class: Twelvefactor::Environment::Cache::File

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

Class Method Summary collapse

Class Method Details

.apply(app, cache_url) ⇒ Object



3
4
5
6
# File 'lib/twelvefactor/environment/cache/file.rb', line 3

def self.apply app, cache_url
  config = app.config
  config.cache_store = :file_store, cache_url.path, options(cache_url.query)
end

.options(query) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/twelvefactor/environment/cache/file.rb', line 8

def self.options query
  return {} unless query

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