Sha256: f25edb815f7180990190a0aa4e109878e17decdfdf923afb8694ef2eb1f3a0ae

Contents?: true

Size: 406 Bytes

Versions: 4

Compression:

Stored size: 406 Bytes

Contents

# frozen_string_literal: true
class Twelvefactor::Environment::Cache::Dalli
  def self.apply app, cache_url
    config = app.config

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

  def self.options query
    return {} unless query

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twelvefactor-cache-1.0.3 lib/twelvefactor/environment/cache/dalli.rb
twelvefactor-cache-1.0.2 lib/twelvefactor/environment/cache/dalli.rb
twelvefactor-cache-1.0.1 lib/twelvefactor/environment/cache/dalli.rb
twelvefactor-cache-1.0.0 lib/twelvefactor/environment/cache/dalli.rb