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.
36 37 38 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 36 def initialize(store = RAILS_CACHE) @store = store end |
Class Method Details
.resolve(uri) ⇒ Object
32 33 34 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 32 def self.resolve(uri) new end |
Instance Method Details
#exist?(key) ⇒ Boolean
40 41 42 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 40 def exist?(key) @store.exist?(key) end |
#open(key) ⇒ Object
44 45 46 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 44 def open(key) @store.read(key) end |
#read(key) ⇒ Object
48 49 50 51 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 48 def read(key) body = open(key) body.join if body end |
#write(body) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/action_dispatch/http/rack_cache.rb', line 53 def write(body) buf = [] key, size = slurp(body) { |part| buf << part } @store.write(key, buf) [key, size] end |