CuckooCache::cache::contains

contains iterates through the hash locations for a given element and checks to see if it is present.

Synopsis

Declared in <cuckoocache.h>

bool
contains(
    Element const& e,
    bool const erase) const;

Description

contains does not check garbage collected state (in other words, garbage is only collected when the space is needed), so:

` insert(x); if (contains(x, true)) return contains(x, false); else return true; `

executed on a single thread will always return true!

This is a great property for re-org performance for example.

contains returns a bool set true if the element was found.

Return Value

true if the element is found, false otherwise

Parameters

NameDescription
ethe element to check
erasewhether to attempt setting the garbage collect flag

Postconditions

  • if erase is true and the element is found, then the garbage collect flag is set