BloombergLP::bdlcc::Cache::Cache

Create an empty cache with the specified eviction policy and watermarks.

Synopsis

Declared in <bdlcc_cache.h>

Cache(
    CacheEvictionPolicy::Enum evictionPolicy,
    std::size_t lowWatermark,
    std::size_t highWatermark,
    bslma::Allocator* basicAllocator = 0);

Description

Create an empty cache using the specified evictionPolicy and the specified lowWatermark and highWatermark. 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

NameDescription
evictionPolicypolicy used to select items for eviction
lowWatermarksize at which eviction stops
highWatermarksize at which eviction starts after an insert
basicAllocatorallocator used to supply memory