Class: Sprockets::Cache::NullStore

Inherits:
Object
  • Object
show all
Defined in:
lib/sprockets/cache/null_store.rb

Overview

Public: A compatible cache store that doesn’t store anything. Used by default when no Environment#cache is configured.

Assign the instance to the Environment#cache.

environment.cache = Sprockets::Cache::NullStore.new

See Also

ActiveSupport::Cache::NullStore

Instance Method Summary collapse

Instance Method Details

#clear(options = nil) ⇒ Object

Public: Simulate clearing the cache

Returns true



49
50
51
# File 'lib/sprockets/cache/null_store.rb', line 49

def clear(options=nil)
  true
end

#get(key) ⇒ Object

Public: Simulate a cache miss.

This API should not be used directly, but via the Cache wrapper API.

key - String cache key.

Returns nil.



23
24
25
# File 'lib/sprockets/cache/null_store.rb', line 23

def get(key)
  nil
end

#inspectObject

Public: Pretty inspect

Returns String.



42
43
44
# File 'lib/sprockets/cache/null_store.rb', line 42

def inspect
  "#<#{self.class}>"
end

#set(key, value) ⇒ Object

Public: Simulate setting a value in the cache.

This API should not be used directly, but via the Cache wrapper API.

key - String cache key. value - Object value.

Returns Object value.



35
36
37
# File 'lib/sprockets/cache/null_store.rb', line 35

def set(key, value)
  value
end