Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CStencilCache Class

Visual Studio .NET 2003

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,
                     CFixedStringKey,
                     CStringElementTraitsI< CFixedStringKey >,
                     FlushClass, CullClass, SyncClass, StatClass >,
   public IStencilCache,
   public IStencilCacheControl,
   public IWorkerThreadClient,
   public IMemoryCacheStats,
   public CComObjectRootEx< CComGlobalsThreadModel >

Parameters

MonitorClass
The class that is to trigger periodic cache maintenance, usually CWorkerThread. The CNoWorkerThread class can be used if no automatic cache maintenance is desired.
StatClass
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.
SyncClass
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.
FlushClass
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.
CullClass
The class that determines if and when cache entries are removed from the cache based on expiration time.

Remarks

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.

Requirements

Header: atlcache.h

See Also

See the Hotswap Sample | BlobCache Sample | StencilCache Sample

Class Members | Caching | Caching Reference | CMemoryCacheBase | IStencilCache | IStencilCacheControl | IWorkerThreadClient | CComObjectRootEx

Show:
© 2015 Microsoft