Sha256: 1e11e42c2251b453c4b466f4b74a39f3943362c0562b401811e36c45b089d706

Contents?: true

Size: 1.37 KB

Versions: 15

Compression:

Stored size: 1.37 KB

Contents

require 'routemaster/middleware/root_post_only'
require 'routemaster/middleware/authenticate'
require 'routemaster/middleware/parse'
require 'routemaster/middleware/filter'
require 'routemaster/middleware/dirty'
require 'routemaster/middleware/cache'
require 'routemaster/drain/terminator'
require 'rack/builder'
require 'delegate'

module Routemaster
  module Drain
    # Rack application which authenticates, parses, filters, pushes to a dirty map,
    # busts cache, schedules preemptive caching, and finally broadcasts events
    # received from Routemaster.
    #
    # See the various corresponding middleware for details on operation:
    # {Middleware::RootPostOnly}, {Middleware::Authenticate},
    # {Middleware::Parse}, {Middleware::Filter}, {Middleware::Dirty},
    # {Middleware::Cache} and {Terminator}.
    #
    class Caching
      extend Forwardable

      def initialize(options = {})
        @terminator = terminator = Terminator.new
        @app = ::Rack::Builder.new do
          use Middleware::RootPostOnly
          use Middleware::Authenticate, options
          use Middleware::Parse
          use Middleware::Filter,       options
          use Middleware::Dirty,        options
          use Middleware::Cache,        options
          run terminator
        end
      end

      delegate :call => :@app
      delegate [:on, :subscribe] => :@terminator
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
routemaster-drain-2.4.4 lib/routemaster/drain/caching.rb
routemaster-drain-2.4.3 lib/routemaster/drain/caching.rb
routemaster-drain-2.4.2 lib/routemaster/drain/caching.rb
routemaster-drain-2.4.1 lib/routemaster/drain/caching.rb
routemaster-drain-2.4.0 lib/routemaster/drain/caching.rb
routemaster-drain-2.3.0 lib/routemaster/drain/caching.rb
routemaster-drain-2.2.2 lib/routemaster/drain/caching.rb
routemaster-drain-2.0.0 lib/routemaster/drain/caching.rb
routemaster-drain-1.1.0 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.5 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.4 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.3 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.2 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.1 lib/routemaster/drain/caching.rb
routemaster-drain-1.0.0 lib/routemaster/drain/caching.rb