123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::RailsEntityStore

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Rack::Cache::EntityStore
Instance Chain:
self, Rack::Cache::EntityStore
Inherits: Rack::Cache::EntityStore
  • ::Object
Defined in: actionpack/lib/action_dispatch/http/rack_cache.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(store = Rails.cache) ⇒ RailsEntityStore

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 35

def initialize(store = Rails.cache)
  @store = store
end

Class Method Details

.resolve(uri)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 31

def self.resolve(uri)
  new
end

Instance Method Details

#exist?(key) ⇒ Boolean

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 39

def exist?(key)
  @store.exist?(key)
end

#open(key)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 43

def open(key)
  @store.read(key)
end

#read(key)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 47

def read(key)
  body = open(key)
  body.join if body
end

#write(body)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 52

def write(body)
  buf = []
  key, size = slurp(body) { |part| buf << part }
  @store.write(key, buf)
  [key, size]
end