HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EfPageCacheStorage Class Reference

Manages a page cache and provides methods for invalidation of cached values. More...

#include <pageCacheStorage.h>

Public Member Functions

EF_API ~EfPageCacheStorage ()
 
EF_API bool IsEnabled () const
 
EF_API void SetEnabled (bool enable)
 
EF_API const VdfRequestGetCacheableRequest (const VdfRequest &request) const
 
EF_API bool GetCachedKeys (const _CacheIteratorPredicateFunction &predicate, const VdfRequest &request, std::vector< const VdfVector * > *cachedKeys) const
 
EF_API void Invalidate (const _CacheIteratorPredicateFunction &predicate)
 
EF_API void Invalidate (const _CacheIteratorPredicateFunction &predicate, const VdfMaskedOutputVector &invalidationRequest)
 
EF_API void Clear ()
 
EF_API void ClearNodes (const VdfNetwork &network, const tbb::concurrent_vector< VdfIndex > &nodes)
 
EF_API void Resize (const VdfNetwork &network)
 
EF_API void WillDeleteNode (const VdfNode &node)
 

Static Public Member Functions

template<typename T >
static EfPageCacheStorageNew (const VdfMaskedOutput &keyMaskedOutput, EfLeafNodeCache *leafNodeCache)
 
static EF_API size_t GetNumBytesUsed ()
 
static EF_API size_t GetNumBytesLimit ()
 
static EF_API bool HasReachedMemoryLimit ()
 
static EF_API void SetMemoryUsageLimit (size_t bytes)
 

Friends

template<template< typename > class E, typename D >
class EfPageCacheBasedExecutor
 
class EfPageCacheCommitRequest
 

Detailed Description

Manages a page cache and provides methods for invalidation of cached values.

Definition at line 43 of file pageCacheStorage.h.

Constructor & Destructor Documentation

EF_API EfPageCacheStorage::~EfPageCacheStorage ( )

Destructor.

Member Function Documentation

EF_API void EfPageCacheStorage::Clear ( )

Clear the entire cache on all pages.

EF_API void EfPageCacheStorage::ClearNodes ( const VdfNetwork network,
const tbb::concurrent_vector< VdfIndex > &  nodes 
)

Clears the output values associated with all the given nodes in the provided network.

EF_API const VdfRequest& EfPageCacheStorage::GetCacheableRequest ( const VdfRequest request) const

Given any request, returns another request containing the outputs, which are dependent on the key output, and thus can be committed to the page cache.

EF_API bool EfPageCacheStorage::GetCachedKeys ( const _CacheIteratorPredicateFunction &  predicate,
const VdfRequest request,
std::vector< const VdfVector * > *  cachedKeys 
) const

Returns the set of keys that have been cached in the pages selected by the predicate, as determined by the set of outputs contained in the request. Returns false if the request does not contain any cacheable outputs.

static EF_API size_t EfPageCacheStorage::GetNumBytesLimit ( )
static

Returns the upper cache storage memory limit, in bytes.

static EF_API size_t EfPageCacheStorage::GetNumBytesUsed ( )
static

Returns the amount of memory currently used for cache storage, in bytes.

static EF_API bool EfPageCacheStorage::HasReachedMemoryLimit ( )
static

Returns true, if the upper memory limit has been reached, and the object is no longer allowed to allocate additional storage to cache new values.

EF_API void EfPageCacheStorage::Invalidate ( const _CacheIteratorPredicateFunction &  predicate)

Invalidate the page cache by clearing the entire cache on the pages determined by the invalidation predicate.

EF_API void EfPageCacheStorage::Invalidate ( const _CacheIteratorPredicateFunction &  predicate,
const VdfMaskedOutputVector invalidationRequest 
)

Invalidate the page cache by clearing the output values dependent on the invalidationRequest, on the pages determined by the invalidation predicate.

EF_API bool EfPageCacheStorage::IsEnabled ( ) const

Returns true if the storage is enabled, i.e. output values can be committed and retrieved from the cache.

template<typename T >
EfPageCacheStorage * EfPageCacheStorage::New ( const VdfMaskedOutput keyMaskedOutput,
EfLeafNodeCache leafNodeCache 
)
static

Constructor helper.

Use this to construct heap allocated instances of this class, with the given leafNodeCache.

Definition at line 257 of file pageCacheStorage.h.

EF_API void EfPageCacheStorage::Resize ( const VdfNetwork network)

Resizes the internal structures of the page cache to be able to accommodate output values for the provided network.

Note
It's not thread-safe to Resize() while the page cache storage is concurrently being accessed.
EF_API void EfPageCacheStorage::SetEnabled ( bool  enable)

Enables / disables the storage.

static EF_API void EfPageCacheStorage::SetMemoryUsageLimit ( size_t  bytes)
static

Sets the upper memory limit, denoting how much memory this object is allowed to allocate.

EF_API void EfPageCacheStorage::WillDeleteNode ( const VdfNode node)

Call this to notify the page cache storage of nodes that have been deleted from the network.

Friends And Related Function Documentation

template<template< typename > class E, typename D >
friend class EfPageCacheBasedExecutor
friend

Definition at line 47 of file pageCacheStorage.h.

Definition at line 50 of file pageCacheStorage.h.


The documentation for this class was generated from the following file: