lib/falcon/server.rb in falcon-0.35.4 vs lib/falcon/server.rb in falcon-0.35.5
- old
+ new
@@ -23,19 +23,25 @@
require 'async/http/server'
require 'protocol/http/middleware/builder'
require 'protocol/http/content_encoding'
+require 'async/http/cache'
+
require_relative 'verbose'
require_relative 'adapters/rewindable'
require_relative 'adapters/rack'
module Falcon
class Server < Async::HTTP::Server
- def self.middleware(rack_app, verbose: false)
+ def self.middleware(rack_app, verbose: false, cache: true)
::Protocol::HTTP::Middleware.build do
if verbose
use Verbose
+ end
+
+ if cache
+ use Async::HTTP::Cache::General
end
use ::Protocol::HTTP::ContentEncoding
use Adapters::Rewindable
use Adapters::Rack