Module: UberS3::Operation::Object::HttpCache::InstanceMethods
- Defined in:
- lib/uber-s3/operation/object/http_cache.rb
Instance Method Summary collapse
- #cache_control ⇒ Object
-
#cache_control=(x) ⇒ Object
TODO: shouldn’t need this junk…
- #expires ⇒ Object
-
#expires=(val) ⇒ Object
Expires can take a time or string.
-
#infer_cache_control! ⇒ Object
TODO…
- #pragma ⇒ Object
- #pragma=(x) ⇒ Object
- #ttl ⇒ Object
-
#ttl=(val) ⇒ Object
Helper method that will set the max-age for cache-control.
Instance Method Details
#cache_control ⇒ Object
22 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 22 def cache_control; @cache_control; end |
#cache_control=(x) ⇒ Object
TODO: shouldn’t need this junk… see above comment
21 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 21 def cache_control=(x); @cache_control = x; end |
#expires ⇒ Object
25 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 25 def expires; @expires; end |
#expires=(val) ⇒ Object
Expires can take a time or string
55 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 55 def expires=(x); @expires = x; end |
#infer_cache_control! ⇒ Object
TODO… there are some edge cases here.. ie. someone sets their own self.content_type …
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 41 def infer_cache_control! return if ttl.nil? || content_type.nil? if ttl.is_a?(Hash) mime_types = ttl.keys match = mime_types.find {|pattern| !(content_type =~ /#{pattern}/i).nil? } self.cache_control = "public,max-age=#{ttl[match]}" if match else self.cache_control = "public,max-age=#{ttl}" end end |
#pragma ⇒ Object
28 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 28 def pragma; @pragma; end |
#pragma=(x) ⇒ Object
27 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 27 def pragma=(x); @pragma = x; end |
#ttl ⇒ Object
31 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 31 def ttl; @ttl; end |
#ttl=(val) ⇒ Object
Helper method that will set the max-age for cache-control
36 |
# File 'lib/uber-s3/operation/object/http_cache.rb', line 36 def ttl=(x); @ttl = x; end |