persistent-cache-cpp
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.
 

Enumerations

enum class  CacheDiscardPolicy { lru_ttl , lru_only }
 Indicates the discard policy to make room for entries when the cache is full. More...
 
enum class  CacheEvent : uint32_t {
  get = 1 << 0 , put = 1 << 1 , invalidate = 1 << 2 , touch = 1 << 3 ,
  miss = 1 << 4 , evict_ttl = 1 << 5 , evict_lru = 1 << 6 , 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.
 
CacheEventoperator|= (CacheEvent &left, CacheEvent right)
 Assigns the bitwise OR of left and right to left.
 
CacheEvent operator& (CacheEvent left, CacheEvent right)
 Returns the bitwise AND of two event types.
 
CacheEventoperator&= (CacheEvent &left, CacheEvent right)
 Assigns the bitwise AND of left and right to left.
 
CacheEvent operator~ (CacheEvent ev)
 Returns the bitwise NOT of ev. Unused bits are set to zero.
 

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 class 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 class 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.