Class: ImageVise::ExpireAfter
- Inherits:
-
Struct
- Object
- Struct
- ImageVise::ExpireAfter
- Defined in:
- lib/image_vise/operators/expire_after.rb
Overview
Overrides the cache lifetime set in the output headers of the RenderEngine. Can be used to permit the requester to set the caching lifetime, instead of it being a configuration variable in the service performing the rendering
Instance Attribute Summary collapse
-
#seconds ⇒ Object
Returns the value of attribute seconds.
Instance Method Summary collapse
- #apply!(_, metadata) ⇒ Object
-
#initialize(seconds:) ⇒ ExpireAfter
constructor
A new instance of ExpireAfter.
Constructor Details
#initialize(seconds:) ⇒ ExpireAfter
Returns a new instance of ExpireAfter.
5 6 7 8 9 10 |
# File 'lib/image_vise/operators/expire_after.rb', line 5 def initialize(seconds:) unless seconds.is_a?(Integer) && seconds > 0 raise ArgumentError, "the :seconds parameter must be an Integer and must be above 0, but was %s" % seconds.inspect end super end |
Instance Attribute Details
#seconds ⇒ Object
Returns the value of attribute seconds
4 5 6 |
# File 'lib/image_vise/operators/expire_after.rb', line 4 def seconds @seconds end |
Instance Method Details
#apply!(_, metadata) ⇒ Object
12 13 14 |
# File 'lib/image_vise/operators/expire_after.rb', line 12 def apply!(_, ) [:expire_after_seconds] = seconds end |