Sha256: f113ed5789b27f9fde7cc2fcfc56aab9f61fa1102cd4e7cbd742c26bb6db99e6

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

module BasicCache
  ##
  # No-op store object, does not store information
  class NullStore
    attr_reader :raw

    ##
    # Generate an empty store

    def initialize
      @raw = nil
    end

    ##
    # Clears a specified key or the whole store

    def clear!(*_)
      true
    end

    ##
    # Retrieve a key

    def [](_)
      nil
    end

    ##
    # Set a key

    def []=(_, value)
      value
    end

    ##
    # Return the size of the store

    def size
      0
    end

    ##
    # Check for a key in the store

    def include?(_)
      false
    end

    ##
    # Array of keys in the store

    def keys
      []
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
basiccache-0.2.1 lib/basiccache/stores/nullstore.rb
basiccache-0.2.0 lib/basiccache/stores/nullstore.rb