Class: FastExists::Backends::Null

Inherits:
Base
  • Object
show all
Defined in:
lib/fast_exists/backends/null.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #load, #rebuild, #save

Constructor Details

This class inherits a constructor from FastExists::Backends::Base

Instance Method Details

#add(_key) ⇒ Object



6
7
8
# File 'lib/fast_exists/backends/null.rb', line 6

def add(_key)
  true
end

#capacityObject



22
23
24
# File 'lib/fast_exists/backends/null.rb', line 22

def capacity
  @expected_elements
end

#clearObject



14
15
16
# File 'lib/fast_exists/backends/null.rb', line 14

def clear
  true
end

#contains?(_key) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/fast_exists/backends/null.rb', line 10

def contains?(_key)
  true # Always maybe present -> forces DB check (safe fallback)
end

#countObject



18
19
20
# File 'lib/fast_exists/backends/null.rb', line 18

def count
  0
end

#statsObject



26
27
28
# File 'lib/fast_exists/backends/null.rb', line 26

def stats
  { backend: :null, capacity: capacity, count: 0, status: :disabled }
end