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
__declspec(uuid("b721b49d-bb57-47bc-ac43-a8d4c07d183d"))
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>
{
    BEGIN_COM_MAP(CMemoryCacheClient)
        COM_INTERFACE_ENTRY(IMemoryCacheClient)
    END_COM_MAP()

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