Skip to main content
ATL Server Library Reference 
IMemoryCacheClient Interface 

This interface provides a method that can be called to free an item that is being removed from a cache.

__interface ATL_NO_VTABLE
IMemoryCacheClient :
   public IUnknown

This interface is used by CMemoryCache, CStencilCache, and derived classes to allow clients to be notified when an item is finally removed from the cache. These classes store a pointer to an IMemoryCacheClient implementation along with the item data so that they can call Free when the cached item is no longer needed. Implementations of IMemoryCacheClient will typically free memory and other resources associated with the cached item at that time.

This interface is implemented by CStencil and CSharedCache.

Header: atlcache.h

class CMemoryCacheClient :
    public IMemoryCacheClient,
    public CComObjectRootEx<CComGlobalsThreadModel>

    STDMETHOD(Free)(const void *pvData)
        void** p = (void**) pvData;
        ::HeapFree(::GetProcessHeap(), 0, p);
        return S_OK;