Class: Rack::Cache::EntityStore::Noop

Inherits:
Rack::Cache::EntityStore show all
Defined in:
lib/rack/cache/entity_store.rb

Overview

Noop Entity Store backend.

Set ‘entitystore` to ’noop:/‘. Does not persist response bodies (no disk/memory used). Responses from the cache will have an empty body. Clients must ignore these empty cached response (check for x-rack-cache response header). Atm cannot handle streamed responses, patch needed.

Constant Summary

Constants inherited from Rack::Cache::EntityStore

DISK, FILE, GAE, GAECACHE, HEAP, MEM, MEMCACHE, MEMCACHED, NOOP

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resolve(uri) ⇒ Object



363
364
365
# File 'lib/rack/cache/entity_store.rb', line 363

def self.resolve(uri)
  new
end

Instance Method Details

#exist?(key) ⇒ Boolean

Returns:

  • (Boolean)


342
343
344
# File 'lib/rack/cache/entity_store.rb', line 342

def exist?(key)
  true
end

#open(key) ⇒ Object



350
351
352
# File 'lib/rack/cache/entity_store.rb', line 350

def open(key)
  []
end

#purge(key) ⇒ Object



359
360
361
# File 'lib/rack/cache/entity_store.rb', line 359

def purge(key)
  nil
end

#read(key) ⇒ Object



346
347
348
# File 'lib/rack/cache/entity_store.rb', line 346

def read(key)
  ''
end

#write(body, ttl = nil) ⇒ Object



354
355
356
357
# File 'lib/rack/cache/entity_store.rb', line 354

def write(body, ttl=nil)
  key, size = slurp(body) { |part| part }
  [key, size]
end