Class: Rack::CacheBuster
- Inherits:
-
Object
- Object
- Rack::CacheBuster
- Defined in:
- lib/rack/cache_buster.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CacheControlHeader, Rails
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, key, target_time = nil) ⇒ CacheBuster
constructor
A new instance of CacheBuster.
Constructor Details
#initialize(app, key, target_time = nil) ⇒ CacheBuster
Returns a new instance of CacheBuster.
5 6 7 8 9 |
# File 'lib/rack/cache_buster.rb', line 5 def initialize(app, key, target_time = nil) @app, @target_time = app, target_time @key = "-"+Digest::MD5.hexdigest(key || "blank-key").freeze @key_regexp = /#{@key}/.freeze end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 |
# File 'lib/rack/cache_buster.rb', line 11 def call(env) status, headers, body = app.call(unpatch_etag(env)) [status, patch_etag(limit_cache(headers)), body] end |