Class: Routemaster::Drain::CacheBusting

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/routemaster/drain/cache_busting.rb

Overview

Rack application which authenticates, parses, filters duplicates in this request and invalidates the cache for all updated or new items.

See the various corresponding middleware for details on operation: Middleware::RootPostOnly, Middleware::Authenticate, Middleware::Parse, Middleware::ExpireCache and Terminator.

Instance Method Summary collapse

Methods included from Forwardable

_compile_method

Constructor Details

#initialize(options = {}) ⇒ CacheBusting

Returns a new instance of CacheBusting.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/routemaster/drain/cache_busting.rb', line 23

def initialize(options = {})
  @terminator = terminator = Terminator.new
  @app = ::Rack::Builder.new do
    use Middleware::RootPostOnly
    use Middleware::Authenticate, options
    use Middleware::Parse
    use Middleware::Siphon,       options
    use Middleware::Filter, { filter: Routemaster::Middleware::PayloadFilter.new }.merge(options)
    use Middleware::ExpireCache
    run terminator
  end
end