Class: ContentCaching::Adapter::Aws
- Inherits:
-
Object
- Object
- ContentCaching::Adapter::Aws
- Defined in:
- lib/content_caching/adapters/aws.rb
Constant Summary collapse
- T_1_DAY =
86400.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #delete(document_path) ⇒ Object
-
#initialize(options) ⇒ Aws
constructor
A new instance of Aws.
- #store(document_path, content) ⇒ Object
- #url(document_path) ⇒ Object
Constructor Details
#initialize(options) ⇒ Aws
Returns a new instance of Aws.
11 12 13 |
# File 'lib/content_caching/adapters/aws.rb', line 11 def initialize @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/content_caching/adapters/aws.rb', line 9 def @options end |
Instance Method Details
#delete(document_path) ⇒ Object
27 28 29 30 31 |
# File 'lib/content_caching/adapters/aws.rb', line 27 def delete document_path retry_3_times do s3_interface.delete self.[:directory], document_path end end |
#store(document_path, content) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/content_caching/adapters/aws.rb', line 15 def store document_path, content retry_3_times do content.rewind if content.respond_to?(:rewind) s3_interface.put self.[:directory], document_path, (content.respond_to?(:read) ? content.read : content) end end |
#url(document_path) ⇒ Object
23 24 25 |
# File 'lib/content_caching/adapters/aws.rb', line 23 def url document_path s3_interface.get_link self.[:directory], document_path, T_1_DAY end |