The OLE Data Cache

Clients often find it useful, especially in the context of OLE Documents, to cache an object's image or presentation for use later when that object is no longer available. To assist in this matter, OLE provides a data cache service, which consists of one object that implements IDataObject, IPersistStorage, IViewObject2, IOleCache2 (derived from IOleCache), and IOleCacheControl. The data cache is accessed through the OLE API function CreateDataCache:


HRESULT CreateDataCache(IUnknown *pUnkOuter, REFCLSID rclsid
, REFIID riid, void **ppv)

Here pUnkOuter allows another object to aggregate on the cache, rclsid represents the CLSID used to generate icon labels (this is usually CLSID_NULL), and riid and ppv are the same as for QueryInterface. The reason the data cache supports aggregation so directly is that in-process objects commonly expose one or more of the cache's own interfaces directly (for example, IPersistStorage or IDataObject) when the object doesn't want to modify the behavior of the cache itself.