Export (0) Print
Expand All

CFileCache Class 

This class implements a file cache.


template <
   class MonitorClass,
   class StatClass     = CStdStatClass,
   class FileCachePeer = CNoFileCachePeer,
   class FlushClass    = COldFlusher,
   class SyncClass     = CComCriticalSection,
   class CullClass     = CExpireCuller
>
class CFileCache :
   public CMemoryCacheBase< CFileCache, LPSTR,
               CCacheDataPeer< FileCachePeer >, CFixedStringKey,
               CStringElementTraits< CFixedStringKey >, FlushClass,
               CullClass, SyncClass, StatClass >,
   public IWorkerThreadClient,
   public IFileCache,
   public IMemoryCacheControl,
   public IMemoryCacheStats

Parameters

MonitorClass

The class to be used for periodic cache maintenance. Normally this will be CWorkerThread. If no cache maintenance is desired, use CNoWorkerThread.

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.

This class is used to remove items from the cache in order to comply with the size and memory constraints specified through the IMemoryCacheControl interface.

SyncClass

The 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 overhead 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.

Although CFileCache is a memory-based cache, it does not store files in memory. Only the name of the file is stored in the cache. The file itself remains on disk and is managed by the cache only in the sense that it is deleted when its cache entry expires. As a result, it is very important to provide the file cache with the names of expendable files.

Header: atlcache.h

Community Additions

ADD
Show:
© 2014 Microsoft