class ActiveFedora::LdpCache

Active Fedora Ldp Cache

Public Class Methods

new(app) click to toggle source
# File lib/active_fedora/ldp_cache.rb, line 19
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# 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

Private Instance Methods

reset_cache_settings() click to toggle source
# File lib/active_fedora/ldp_cache.rb, line 38
def reset_cache_settings
  ActiveFedora.fedora.connection.clear_cache
  ActiveFedora.fedora.connection.disable_cache!
end