Class: OpenURI::Cache
- Inherits:
-
Object
- Object
- OpenURI::Cache
- Defined in:
- lib/openuri/common.rb,
lib/openuri/memcached.rb,
lib/openuri/rails-cache.rb
Class Attribute Summary collapse
-
.expiry ⇒ Object
How long your caches will be kept for (in seconds).
- .host ⇒ Object
Class Method Summary collapse
-
.disable! ⇒ Object
Disable caching - all queries will be run directly using the standard OpenURI ‘open` method.
- .disabled? ⇒ Boolean
-
.enable! ⇒ Object
Enable caching.
-
.enabled? ⇒ Boolean
Is the cache enabled?.
- .get(key) ⇒ Object
- .set(key, value) ⇒ Object
Class Attribute Details
.expiry ⇒ Object
How long your caches will be kept for (in seconds)
81 82 83 |
# File 'lib/openuri/common.rb', line 81 def expiry @expiry ||= 60 * 10 end |
.host ⇒ Object
85 86 87 |
# File 'lib/openuri/common.rb', line 85 def host @host ||= "127.0.0.1:11211" end |
Class Method Details
.disable! ⇒ Object
Disable caching - all queries will be run directly using the standard OpenURI ‘open` method.
64 65 66 |
# File 'lib/openuri/common.rb', line 64 def disable! @cache_enabled = false end |
.disabled? ⇒ Boolean
68 69 70 |
# File 'lib/openuri/common.rb', line 68 def disabled? !@cache_enabled end |
.enable! ⇒ Object
Enable caching
58 59 60 |
# File 'lib/openuri/common.rb', line 58 def enable! raise NotImplementedError end |
.enabled? ⇒ Boolean
Is the cache enabled?
53 54 55 |
# File 'lib/openuri/common.rb', line 53 def enabled? @cache_enabled end |
.get(key) ⇒ Object
72 73 74 |
# File 'lib/openuri/common.rb', line 72 def get(key) raise NotImplementedError end |
.set(key, value) ⇒ Object
76 77 78 |
# File 'lib/openuri/common.rb', line 76 def set(key, value) raise NotImplementedError end |