Class: Faraday::EdsCachingMiddleware
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::EdsCachingMiddleware
- Defined in:
- lib/faraday/eds_caching_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, *args) ⇒ EdsCachingMiddleware
constructor
A new instance of EdsCachingMiddleware.
Constructor Details
#initialize(app, *args) ⇒ EdsCachingMiddleware
Returns a new instance of EdsCachingMiddleware.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/faraday/eds_caching_middleware.rb', line 9 def initialize(app, *args) super(app) = args.first || {} @auth_expire = .fetch(:auth_expire, 1500) @info_expire = .fetch(:info_expire, 86400) @retrieve_expire = .fetch(:retrieve_expire, 1800) @search_expire = .fetch(:search_expire, 1800) @export_format_expire = .fetch(:export_format_expire, 86400) @citation_styles_expire = .fetch(:citation_styles_expire, 86400) @logger = .fetch(:logger, nil) @namespace = .fetch(:namespace, 'faraday-eds-cache') @store = .fetch(:store, :memory_store) @store_options = .fetch(:store_options, {}) @store_options[:namespace] ||= @namespace initialize_store @cacheable_paths = %w(/edsapi/rest/Info /authservice/rest/uidauth /authservice/rest/uidauth /edsapi/rest/Retrieve? /edsapi/rest/Search? /edsapi/rest/ExportFormat /edsapi/rest/CitationStyles) end |
Instance Method Details
#call(env) ⇒ Object
31 32 33 |
# File 'lib/faraday/eds_caching_middleware.rb', line 31 def call(env) dup.call!(env) end |