persistent-cache-cpp: core Namespace Reference

persistent-cache-cpp

Classes | Typedefs | Enumerations | Functions
core Namespace Reference

Top-level namespace for core functionality. More...

## Classes
struct | CacheCodec
class | PersistentCache
| A persistent cache of key-value pairs and metadata of user-defined type. More...
class | PersistentCacheStats
| Class that provides (read-only) access to cache statistics and settings. More...
class | PersistentStringCache
| A cache of key-value pairs with persistent storage. More...

## Typedefs
template<typename T >
using | Optional = boost::optional< T >
| Convenience typedef for nullable values. More...

## Enumerations
enum | CacheDiscardPolicy { CacheDiscardPolicy::lru_ttl, CacheDiscardPolicy::lru_only }
| Indicates the discard policy to make room for entries when the cache is full. More...
enum | CacheEvent : uint32_t { CacheEvent::get = 1 << 0, CacheEvent::put = 1 << 1, CacheEvent::invalidate = 1 << 2, CacheEvent::touch = 1 << 3, CacheEvent::miss = 1 << 4, CacheEvent::evict_ttl = 1 << 5, CacheEvent::evict_lru = 1 << 6, CacheEvent::END_ = 1 << 7 }
| Event types that can be monitored. More...

## Functions
CacheEvent | operator| (CacheEvent left, CacheEvent right)
| Returns the bitwise OR of two event types. More...
CacheEvent & | operator|= (CacheEvent &left, CacheEvent right)
| Assigns the bitwise OR of `left` and `right` to `left`. More...
CacheEvent | operator& (CacheEvent left, CacheEvent right)
| Returns the bitwise AND of two event types. More...
CacheEvent & | operator&= (CacheEvent &left, CacheEvent right)
| Assigns the bitwise AND of `left` and `right` to `left`. More...
CacheEvent | operator~ (CacheEvent ev)
| Returns the bitwise NOT of `ev`. Unused bits are set to zero. More...

## Detailed Description

Top-level namespace for core functionality.

## Typedef Documentation

## ◆ Optional

template<typename T >

using core::Optional = typedef boost::optional<T>

Convenience typedef for nullable values.

Note
  You should use `core::Optional` in preference to `boost::optional` in your code. This will ease an eventual transition to `std::optional`.

## Enumeration Type Documentation

## ◆ CacheDiscardPolicy

enum core::CacheDiscardPolicy
| strong

Indicates the discard policy to make room for entries when the cache is full.

Once the cache is full and another entry is added, `lru_ttl` unconditionally deletes all entries that have expired and then, if deleting these entries did not create sufficient free space, deletes entries in least-recently-used order until enough space is available.

If the discard policy is set to `lru_only`, entries do not maintain an expiry time and are therefore discarded strictly in LRU order.

Enumerator
lru_ttl | Evict expired entries first, followed by eviction in LRU order.
lru_only | Evict in LRU order.

## ◆ CacheEvent

enum core::CacheEvent : uint32_t
| strong

Event types that can be monitored.

Enumerator
get | An entry was returned by a call to `get()`, `get_or_put()`, `take()`, or `take_data()`.
put | An entry was added by a call to `put()` or `get_or_put()`.
invalidate | An entry was removed by a call to `invalidate()`, `take()`, or `take_data()`.
touch | An entry was refreshed by a call to `touch()`.
miss | A call to `get()`, `get_or_put()`, `take()`, or `take_data()` failed to return an entry.
evict_ttl | An expired entry was evicted due to a call to `put()`, `get_or_put()`, `trim_to()`, or `resize()`.
evict_lru | The oldest entry was evicted due to a call to `put()`, `get_or_put()`, `trim_to()`, or `resize()`.
END_ | End marker.

## Function Documentation

## ◆ operator&()

CacheEvent core::operator& | ( | CacheEvent | left,
|  | CacheEvent | right
| ) |  |
| inline

Returns the bitwise AND of two event types.

## ◆ operator&=()

CacheEvent& core::operator&= | ( | CacheEvent & | left,
|  | CacheEvent | right
| ) |  |
| inline

Assigns the bitwise AND of `left` and `right` to `left`.

## ◆ operator|()

CacheEvent core::operator| | ( | CacheEvent | left,
|  | CacheEvent | right
| ) |  |
| inline

Returns the bitwise OR of two event types.

## ◆ operator|=()

CacheEvent& core::operator|= | ( | CacheEvent & | left,
|  | CacheEvent | right
| ) |  |
| inline

Assigns the bitwise OR of `left` and `right` to `left`.

## ◆ operator~()

CacheEvent core::operator~ | ( | CacheEvent | ev | ) |
| inline

Returns the bitwise NOT of `ev`. Unused bits are set to zero.