LLVM 22.0.0git
llvm::cas::ActionCache Class Referenceabstract

A cache from a key (that describes an action) to the result of performing that action. More...

#include "llvm/CAS/ActionCache.h"

Public Member Functions

Expected< std::optional< CASID > > get (const CacheKey &ActionKey, bool CanBeDistributed=false) const
 Get a previously computed result for ActionKey.
Error put (const CacheKey &ActionKey, const CASID &Result, bool CanBeDistributed=false)
 Cache Result for the ActionKey computation.
virtual ~ActionCache ()=default

Protected Member Functions

virtual Expected< std::optional< CASID > > getImpl (ArrayRef< uint8_t > ResolvedKey, bool CanBeDistributed) const =0
virtual Error putImpl (ArrayRef< uint8_t > ResolvedKey, const CASID &Result, bool CanBeDistributed)=0
 ActionCache (const CASContext &Context)
const CASContextgetContext () const

Detailed Description

A cache from a key (that describes an action) to the result of performing that action.

Actions are expected to be pure. Storing mappings from one action to multiple results will result in error (cache poisoning).

Definition at line 49 of file ActionCache.h.

Constructor & Destructor Documentation

◆ ~ActionCache()

virtual llvm::cas::ActionCache::~ActionCache ( )
virtualdefault

◆ ActionCache()

llvm::cas::ActionCache::ActionCache ( const CASContext & Context)
inlineprotected

Definition at line 89 of file ActionCache.h.

Member Function Documentation

◆ get()

Expected< std::optional< CASID > > llvm::cas::ActionCache::get ( const CacheKey & ActionKey,
bool CanBeDistributed = false ) const
inline

Get a previously computed result for ActionKey.

Parameters
CanBeDistributedis a hint to the underlying implementation that if it is true, the lookup is profitable to be done on a distributed caching level, not just locally. The implementation is free to ignore this flag.

Definition at line 58 of file ActionCache.h.

References llvm::arrayRefFromStringRef(), getImpl(), and llvm::cas::CacheKey::getKey().

◆ getContext()

const CASContext & llvm::cas::ActionCache::getContext ( ) const
inlineprotected

Definition at line 91 of file ActionCache.h.

Referenced by put().

◆ getImpl()

virtual Expected< std::optional< CASID > > llvm::cas::ActionCache::getImpl ( ArrayRef< uint8_t > ResolvedKey,
bool CanBeDistributed ) const
protectedpure virtual

Referenced by get().

◆ put()

Error llvm::cas::ActionCache::put ( const CacheKey & ActionKey,
const CASID & Result,
bool CanBeDistributed = false )
inline

Cache Result for the ActionKey computation.

Parameters
CanBeDistributedis a hint to the underlying implementation that if it is true, the association is profitable to be done on a distributed caching level, not just locally. The implementation is free to ignore this flag.

Definition at line 69 of file ActionCache.h.

References llvm::arrayRefFromStringRef(), assert(), getContext(), llvm::cas::CacheKey::getKey(), and putImpl().

◆ putImpl()

virtual Error llvm::cas::ActionCache::putImpl ( ArrayRef< uint8_t > ResolvedKey,
const CASID & Result,
bool CanBeDistributed )
protectedpure virtual

Referenced by put().


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