Skip to main content
ATL Server Library Reference 
CMemoryCache Class 

This class represents a generic memory cache.


template <
   typename DataType,
   class StatClass  = CStdStatClass,
   class FlushClass = COldFlusher,
   class keyType    = CFixedStringKey,
   class KeyTrait   = CStringElementTraits< CFixedStringKey >,
   class SyncClass  = CComCriticalSection,
   class CullClass  = CExpireCuller
>
class CMemoryCache :
   public CMemoryCacheBase< CMemoryCache, DataType, CCacheDataEx,
                                                        keyType, KeyTrait, FlushClass, CullClass,
                                                        SyncClass, StatClass >

Parameters

DataType

The data structure that defines the data to be cached. This structure holds the data that users of the cache must provide when adding items to the cache.

StatClass

The class used to collect and expose statistics related to the use of the cache including such information as effectiveness of the cache and memory used. Must conform to the cache statistics archetype.

FlushClass

The class used to determine whether, and in what order, items should be removed from the cache using the number and sequence of accesses as the basis for making the decision. Must conform to the cache flusher archetype.

keyType

The type used to identify elements in the cache.

KeyTrait

The type used to compare keyType objects.

SyncClass

A class to be used for thread synchronization. The default value of CComCriticalSection is suitable for most situations, but the CComFakeCriticalSection class can be used to avoid thread synchronization in single-threaded environments.

CullClass

The class used to determine whether, and in what order, items should be removed from the cache using time-based criteria. Must conform to the cache culler archetype.

This class implements a cache that stores items in memory. CMemoryCache uses CMemoryCacheBase as a base class and adds the ability to associate cached DLLs with cache entries and provide custom destruction for items being removed from the cache.

Header: atlcache.h