Class: ActionDispatch::RailsEntityStore

Inherits:
Rack::Cache::EntityStore
  • Object
show all
Defined in:
actionpack/lib/action_dispatch/http/rack_cache.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (RailsEntityStore) initialize(store = RAILS_CACHE)



36
37
38
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 36

def initialize(store = RAILS_CACHE)
  @store = store
end

Class Method Details

+ (Object) resolve(uri)



32
33
34
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 32

def self.resolve(uri)
  new
end

Instance Method Details

- (Boolean) exist?(key)



40
41
42
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 40

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

- (Object) open(key)



44
45
46
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 44

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

- (Object) read(key)



48
49
50
51
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 48

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

- (Object) write(body)



53
54
55
56
57
58
# File 'actionpack/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