Class: BasicCache::NullStore

Inherits:
Object
  • Object
show all
Defined in:
lib/basiccache/stores/nullstore.rb

Overview

No-op store object, does not store information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_ = {}) ⇒ NullStore

Generate an empty store



10
11
12
# File 'lib/basiccache/stores/nullstore.rb', line 10

def initialize(_ = {})
  @raw = nil
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/basiccache/stores/nullstore.rb', line 5

def raw
  @raw
end

Instance Method Details

#[](_) ⇒ Object

Retrieve a key



24
25
26
# File 'lib/basiccache/stores/nullstore.rb', line 24

def [](_)
  nil
end

#[]=(_, value) ⇒ Object

Set a key



31
32
33
# File 'lib/basiccache/stores/nullstore.rb', line 31

def []=(_, value)
  value
end

#clear!(*_) ⇒ Object

Clears a specified key or the whole store



17
18
19
# File 'lib/basiccache/stores/nullstore.rb', line 17

def clear!(*_)
  true
end

#include?(_) ⇒ Boolean

Check for a key in the store

Returns:

  • (Boolean)


45
46
47
# File 'lib/basiccache/stores/nullstore.rb', line 45

def include?(_)
  false
end

#keysObject

Array of keys in the store



52
53
54
# File 'lib/basiccache/stores/nullstore.rb', line 52

def keys
  []
end

#sizeObject

Return the size of the store



38
39
40
# File 'lib/basiccache/stores/nullstore.rb', line 38

def size
  0
end