Skip to main content
ATL Server Library Reference 
CStencilCache Class 

This class implements a stencil cache, and is used by ATL Server to cache pre-processed stencils to speed response processing.

template <
   class MonitorClass,
   class StatClass  = CStdStatClass,
   class SyncClass  = CComCriticalSection,
   class FlushClass = COldFlusher,
   class CullClass  = CLifetimeCuller
class CStencilCache :
   public CMemoryCacheBase<CStencilCache, void * , CCacheDataEx,
                     CStringElementTraitsI< CFixedStringKey >,
                                          FlushClass, CullClass, SyncClass, StatClass >,
   public IStencilCache,
   public IStencilCacheControl,
   public IWorkerThreadClient,
   public IMemoryCacheStats,
   public CComObjectRootEx< CComGlobalsThreadModel >



The class that is to trigger periodic cache maintenance, usually CWorkerThread. The CNoWorkerThread class can be used if no automatic cache maintenance is desired.


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


The class to be used for thread synchronization. The CComCriticalSection class is used by default, but the CComFakeCriticalSection class can be used to avoid thread safety overhead if the cache resides in a single-threaded environment.


The class that determines which cache items, if any, will be flushed from the cache when the cache item count limit or memory use limit is reached. By default, the COldFlusher class is used, which selects the oldest items for removal.


The class that determines if and when cache entries are removed from the cache based on expiration time.

Flushing classes, other than the default COldFlusher class, include:

The COrFlushers class can be used to combine two flushing mechanisms, or even to build a hierarchy of flusher classes. Alternatively, custom flushing classes can be used, so long as they match the Cache Flusher Archetype.

Regardless of the FlushClass used, items will not be flushed until the cache item count or memory use limits have been reached. By default, these settings are both limited only by the size of the DWORD type. Use the IMemoryCacheStats interface to adjust these cache limits and activate the flushing mechanisms.

Header: atlcache.h