Class: Rack::AcornCache::Configuration
- Inherits:
-
Object
- Object
- Rack::AcornCache::Configuration
- Defined in:
- lib/acorn_cache/config.rb
Instance Attribute Summary collapse
-
#cache_everything ⇒ Object
Returns the value of attribute cache_everything.
-
#default_acorn_cache_ttl ⇒ Object
Returns the value of attribute default_acorn_cache_ttl.
-
#default_browser_cache_ttl ⇒ Object
Returns the value of attribute default_browser_cache_ttl.
-
#default_ignore_query_params ⇒ Object
Returns the value of attribute default_ignore_query_params.
-
#default_must_revalidate ⇒ Object
Returns the value of attribute default_must_revalidate.
-
#page_rules ⇒ Object
Returns the value of attribute page_rules.
- #storage ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #page_rule_for_url(url) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 |
# File 'lib/acorn_cache/config.rb', line 17 def initialize @cache_everything = false @storage = :redis end |
Instance Attribute Details
#cache_everything ⇒ Object
Returns the value of attribute cache_everything.
14 15 16 |
# File 'lib/acorn_cache/config.rb', line 14 def cache_everything @cache_everything end |
#default_acorn_cache_ttl ⇒ Object
Returns the value of attribute default_acorn_cache_ttl.
14 15 16 |
# File 'lib/acorn_cache/config.rb', line 14 def default_acorn_cache_ttl @default_acorn_cache_ttl end |
#default_browser_cache_ttl ⇒ Object
Returns the value of attribute default_browser_cache_ttl.
14 15 16 |
# File 'lib/acorn_cache/config.rb', line 14 def default_browser_cache_ttl @default_browser_cache_ttl end |
#default_ignore_query_params ⇒ Object
Returns the value of attribute default_ignore_query_params.
14 15 16 |
# File 'lib/acorn_cache/config.rb', line 14 def default_ignore_query_params @default_ignore_query_params end |
#default_must_revalidate ⇒ Object
Returns the value of attribute default_must_revalidate.
14 15 16 |
# File 'lib/acorn_cache/config.rb', line 14 def default_must_revalidate @default_must_revalidate end |
#page_rules ⇒ Object
Returns the value of attribute page_rules.
13 14 15 |
# File 'lib/acorn_cache/config.rb', line 13 def page_rules @page_rules end |
#storage ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/acorn_cache/config.rb', line 42 def storage if @storage == :redis Rack::AcornCache::Storage.redis elsif @storage == :memcached Rack::AcornCache::Storage.memcached end end |
Instance Method Details
#page_rule_for_url(url) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/acorn_cache/config.rb', line 28 def page_rule_for_url(url) if cache_everything return default_page_rule unless page_rules no_page_rule_found = proc { return default_page_rule } else return nil unless page_rules no_page_rule_found = proc { return nil } end page_rules.find(no_page_rule_found) do |k, _| page_rule_key_matches_url?(k, url) end.last end |