Class: Zache::Fake
- Inherits:
-
Object
- Object
- Zache::Fake
- Defined in:
- lib/zache.rb
Overview
Fake implementation that doesn’t cache anything, but behaves like it does. It implements all methods of the original class, but doesn’t do any caching. This is very useful for testing.
Instance Method Summary collapse
-
#clean ⇒ nil
No-op method.
-
#exists? ⇒ Boolean
Always returns true regardless of the key.
-
#get { ... } ⇒ Object
Always returns the result of the block, never caches.
-
#locked?(_key) ⇒ Boolean
Always returns false.
-
#put ⇒ nil
No-op method that ignores the input.
-
#remove(_key) ⇒ nil
No-op method that ignores the key.
-
#remove_all ⇒ nil
No-op method.
-
#size ⇒ Integer
Returns a fixed size of 1.
Instance Method Details
#clean ⇒ nil
No-op method.
73 |
# File 'lib/zache.rb', line 73 def clean; end |
#exists? ⇒ Boolean
Always returns true regardless of the key.
44 45 46 |
# File 'lib/zache.rb', line 44 def exists?(*) true end |
#get { ... } ⇒ Object
Always returns the result of the block, never caches.
36 37 38 |
# File 'lib/zache.rb', line 36 def get(*) yield end |
#locked?(_key) ⇒ Boolean
Always returns false.
51 52 53 |
# File 'lib/zache.rb', line 51 def locked?(_key) false end |
#put ⇒ nil
No-op method that ignores the input.
60 |
# File 'lib/zache.rb', line 60 def put(*); end |
#remove(_key) ⇒ nil
No-op method that ignores the key.
65 |
# File 'lib/zache.rb', line 65 def remove(_key); end |
#remove_all ⇒ nil
No-op method.
69 |
# File 'lib/zache.rb', line 69 def remove_all; end |
#size ⇒ Integer
Returns a fixed size of 1.
27 28 29 |
# File 'lib/zache.rb', line 27 def size 1 end |