Class: ActionDispatch::RailsEntityStore
- Inherits:
-
Rack::Cache::EntityStore
- Object
- Rack::Cache::EntityStore
- ActionDispatch::RailsEntityStore
- Defined in:
- lib/action_dispatch/http/rack_cache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #exist?(key) ⇒ Boolean
-
#initialize(store = Rails.cache) ⇒ RailsEntityStore
constructor
A new instance of RailsEntityStore.
- #open(key) ⇒ Object
- #read(key) ⇒ Object
- #write(body) ⇒ Object
Constructor Details
#initialize(store = Rails.cache) ⇒ RailsEntityStore
Returns a new instance of RailsEntityStore.
39 40 41 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 39 def initialize(store = Rails.cache) @store = store end |
Class Method Details
.resolve(uri) ⇒ Object
35 36 37 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 35 def self.resolve(uri) new end |
Instance Method Details
#exist?(key) ⇒ Boolean
43 44 45 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 43 def exist?(key) @store.exist?(key) end |
#open(key) ⇒ Object
47 48 49 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 47 def open(key) @store.read(key) end |
#read(key) ⇒ Object
51 52 53 54 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 51 def read(key) body = open(key) body.join if body end |
#write(body) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 56 def write(body) buf = [] key, size = slurp(body) { |part| buf << part } @store.write(key, buf) [key, size] end |