Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can use the IWMSCacheItem interface to retrieve information about cached content.
In addition to the methods inherited from IDispatch, the IWMSCacheItem interface exposes the following methods.
Method |
Description |
|---|---|
get_ContentSize |
Retrieves the size of the content in bytes. |
get_OriginUrl |
Retrieves the relative URL for the cached content. |
Example
The following example illustrates how to retrieve a pointer to an IWMSCacheItem interface.
#include <windows.h>
#include <atlbase.h> // Includes CComVariant.
#include "wmsserver.h"
// Declare variables and interfaces.
IWMSServer *pServer;
IWMSPlugins *pPlugins;
IWMSPlugin *pPlugin;
IWMSCacheProxyPlugin *pCacheProxyPlugin;
IWMSCacheItems *pCacheItems;
IWMSCacheItem *pCacheItem;
HRESULT hr;
CComVariant varIndex;
long lCount;
// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
NULL,
CLSCTX_ALL,
IID_IWMSServer,
(void **)&pServer);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to an IWMSPlugins interface
// containing cache proxy plug-ins.
hr = pServer->get_CacheProxy(&pPlugins);
if (FAILED(hr)) goto EXIT;
hr = pPlugins->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// Retrieve the IWMSPlugin interface for the
// first cache proxy plug-in.
varIndex = 0;
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSCacheProxyPlugin interface.
hr = pPlugin->QueryInterface(IID_IWMSCacheProxyPlugin,
(void **)&pCacheProxyPlugin);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSCacheItems interface,
// and retrieve the count of cache items.
hr = pCacheProxyPlugin->get_CacheItems(&pCacheItems);
if (FAILED(hr)) goto EXIT;
hr = pCacheItems->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// Retrieve information on each cache item.
for (long x = 0; x < lCount; x++) {
varIndex = x;
hr = pCacheItems->get_Item(varIndex, &pCacheItem);
if (FAILED(hr)) goto EXIT;
// Release temporary COM objects.
pCacheItem->Release();
}
EXIT:
// TODO: Release temporary COM objects and uninitialize COM.