ArThreadLocalScopedCache< CachedType > Class Template Reference

Utility class for custom resolver implementations. More...

Public Types

using CachePtr = std::shared_ptr< CachedType >

Public Member Functions

void BeginCacheScope (VtValue *cacheScopeData)
void EndCacheScope (VtValue *cacheScopeData)
CachePtr GetCurrentCache ()

Detailed Description

template<class CachedType>
class ArThreadLocalScopedCache< CachedType >

Utility class for custom resolver implementations.

This class wraps up a common pattern for implementing thread-local scoped caches for ArResolver::BeginCacheScope and ArResolver::EndCacheScope.

class MyResolver : public ArResolver {
using ResolveCache = ArThreadLocalScopedCache<...>;
ResolveCache _cache;
void BeginCacheScope(VtValue* data) { _cache.BeginCacheScope(data); }
void EndCacheScope(VtValue* data) { _cache.EndCacheScope(data); }
void Resolve(...) {
// If caching is active in this thread, retrieve the current
// cache and use it to lookup/store values.
if (ResolveCache::CachePtr cache = _cache.GetCurrentCache()) {
// ...
// Otherwise, caching is not active
// ...
See also
Scoped Resolution Cache

Definition at line 66 of file threadLocalScopedCache.h.

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