Create an empty cache with custom hash and equality functors.

Synopsis

Declared in <bdlcc_cache.h>

Cache(
    CacheEvictionPolicy::Enum evictionPolicy,
    std::size_t lowWatermark,
    std::size_t highWatermark,
    HASH const& hashFunction,
    EQUAL const& equalFunction,
    bslma::Allocator* basicAllocator = 0);

Description

Create an empty cache using the specified evictionPolicy, lowWatermark, and highWatermark. The specified hashFunction is used to generate the hash values for a given key, and the specified equalFunction is used to determine whether two keys have the same value. Optionally specify the basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless `lowWatermark <= highWatermark`, 1 <= lowWatermark, and `1 <= highWatermark`.

Parameters

Name

Description

evictionPolicy

policy used to select items for eviction

lowWatermark

size at which eviction stops

highWatermark

size at which eviction starts after an insert

hashFunction

hash functor applied to keys

equalFunction

equality functor applied to keys

basicAllocator

allocator used to supply memory

Created with MrDocs