Class: ActiveFedora::LdpCache

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/ldp_cache.rb

Overview

Active Fedora Ldp Cache

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ LdpCache

Returns a new instance of LdpCache.



19
20
21
# File 'lib/active_fedora/ldp_cache.rb', line 19

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  ActiveFedora.fedora.connection.enable_cache!

  response = @app.call(env)
  response[2] = Rack::BodyProxy.new(response[2]) do
    reset_cache_settings
  end

  response
ensure
  reset_cache_settings
end