Share via


IWMSCacheProxy::AddCacheItem

banner art

Previous Next

IWMSCacheProxy::AddCacheItem

The AddCacheItem method is called by the server to prestuff a cache.

Syntax

  HRESULT AddCacheItem(
  
  BSTR
  
  bstrOriginUrl
  ,
  
  BSTR
  
  bstrPrestuffUrl
  ,
  
  long
  
  lExpiration
  ,
  
  long
  
  lBandwidth
  ,
  
  long
  
  lRemoteEventFlags
  ,
  
  IWMSCacheProxyCallback*
  
  pCallback
  ,
  
  VARIANT
  
  varContext
  
  );

Parameters

bstrOriginUrl

[in] BSTR containing the URL on the origin server of the content to be cached.

bstrPrestuffUrl

[in] BSTR containing the URL identifying the location for the cache. If NULL, the method uses bstrOriginUrl.

lExpiration

[in] long containing the amount of time, in seconds, that the cache item is available to be streamed after it has been cached. For example, a value of 86,400 indicates that cached content can be streamed for 24 hours after it is downloaded from the origin server.

lBandwidth

[in] long containing the maximum bandwidth that the server can use when streaming content into cache storage.

lRemoteEventFlags

[in] long containing the remote events that must be passed back to the origin server. This must be one of the following values. For more information, see the WMS_EVENT_TYPE enumeration value.

Event Description
WMS_EVENT_REMOTE_CACHE_OPEN A remote cache proxy server has opened cached content or established a connection to an upstream server.
WMS_EVENT_REMOTE_CACHE_CLOSE A remote cache proxy server has closed a content file or disconnected a client from an upstream server.
WMS_EVENT_REMOTE_CACHE_LOG A client submitted a rendering log to indicate that it streamed content from a local cache, or a cache proxy server submitted a remote log to indicate that it either streamed content from cache or proxied it from an upstream server.

pCallback

[in] Pointer to an IWMSCacheProxyCallback interface. This can be NULL if no callback is requested.

varContext

[in] VARIANT containing a value defined by the server to identify which call to AddCacheItem the plug-in is responding to when it calls IWMSCacheProxyCallback::OnAddCacheItem. The plug-in must pass this value back unaltered.

Return Values

If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.

Remarks

This plug-in can be called whenever an item must be added to a cache. It is always called by the server when the IWMSCacheProxyPlugin::PreStuff method is called. The plug-in calls IWMSCacheProxyCallback::OnAddCacheItem to respond to the AddCacheItem method.

Example Code

      if (FAILED(hr)) goto EXIT;








    if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary objects.
    return(hr);

Requirements

Header: streamcache.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next