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



369
370
371
# File 'lib/rack/cache/entity_store.rb', line 369

def self.resolve(uri)
  new
end

Instance Method Details

#exist?(key) ⇒ Boolean

Returns:

  • (Boolean)


348
349
350
# File 'lib/rack/cache/entity_store.rb', line 348

def exist?(key)
  true
end

#open(key) ⇒ Object



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

def open(key)
  []
end

#purge(key) ⇒ Object



365
366
367
# File 'lib/rack/cache/entity_store.rb', line 365

def purge(key)
  nil
end

#read(key) ⇒ Object



352
353
354
# File 'lib/rack/cache/entity_store.rb', line 352

def read(key)
  ''
end

#write(body, ttl = nil) ⇒ Object



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

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