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.
The server calls the QueryCacheMissPolicy method to query the cache plug-in for a cache-miss policy.
IWMSCacheProxy.QueryCacheMissPolicy( bstrOriginUrl As String,
pUserContext As IWMSContext,
pCommandContext As IWMSCommandContext,
pPresentationContext As IWMSContext,
pCachePluginContext As Object,
lQueryType As Int32,
pCallback As IWMSCacheProxyCallback,
varContext As Object
)
Arguments
[in] String containing the origin URL. |
|
[in] IWMSContextIWMSContext Object (Visual Basic .NET) containing the User Context. |
|
[in] IWMSCommandContextIWMSCommandContext Object (Visual Basic .NET) containing the Command Context. |
|
[in] IWMSContext object containing the Presentation Context. |
|
[in] Object containing a cache plug-in context. |
|
[in] Member of the WMS_CACHE_QUERY_TYPE_FLAGS enumeration type that indicates why the server called IWMSCacheProxy.QueryCache. This must be a bitwise OR of one or more of the following values. |
Value |
Description |
|---|---|
WMS_CACHE_QUERY_OPEN |
A client using a downstream proxy requested content. |
WMS_CACHE_QUERY_GET_CONTENT_INFO |
A downstream proxy requested information about content cached on the remote computer. |
WMS_CACHE_QUERY_CACHE_EVENT |
A cache event notice is being sent upstream. If WMS_CACHE_QUERY_LOCAL_EVENT is set, the cache event was generated by the local computer. Otherwise, it was sent by a downstream proxy server. |
WMS_CACHE_QUERY_REVERSE_PROXY |
A downstream server is configured to be a reverse proxy server. If a cache proxy plug-in supports reverse proxy, it can use this flag to determine whether it must map client requests to an upstream server farm. |
WMS_CACHE_QUERY_LOCAL_EVENT |
The local server is generating an event to send upstream. |
[in] pCallback |
IWMSCacheProxyCallbackIWMSCacheProxyCallback Object (Visual Basic .NET) containing the callback function. The cache plug-in calls IWMSCacheProxyCallback.OnQueryCacheMissPolicy to respond to a call to QueryCache. |
[in] varContext |
Object containing a value defined by the server to identify which call to QueryCacheMissPolicy the plug-in is responding to when it calls IWMSCacheProxyCallback.OnQueryCacheMissPolicy. You must pass this value back unaltered. |
Return Value
This method does not return a value.
Remarks
A proxy server must call QueryCache on the cache plug-in and receive a cache miss before it calls QueryCacheMissPolicy. A custom cache plug-in can use the WMS_CACHE_QUERY_TYPE_FLAGS enumeration type in the lQueryType parameter to direct the implementation of a cache-miss policy.
Example
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Public Sub QueryCacheMissPolicy(ByVal OriginUrl As String, _
ByVal UserContext As IWMSContext, _
ByVal CommandContext As IWMSCommandContext, _
ByVal PresentationContext As IWMSContext, _
ByVal CachePluginContext As Object, _
ByVal lQueryType As Integer, _
ByVal Callback As IWMSCacheProxyCallback, _
ByVal varContext As Object) _
Implements IWMSCacheProxy.QueryCacheMissPolicy
Dim nOpenFlag As Integer
Dim nGCI As Integer
Dim nReverseProxy As Integer
Dim ci As ContentInfo
Dim ciRP As ContentInfo
Dim Response As WMS_CACHE_QUERY_MISS_RESPONSE
Dim ContentInfoContext As IWMSContext
Try
nOpenFlag = WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_OPEN
nGCI = lQueryType And WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_GET_CONTENT_INFO
nReverseProxy = lQueryType & WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_REVERSE_PROXY
' The ContentInfo class is user-defined and includes
' information about a cached item.
ci = New ContentInfo(OriginUrl, Nothing)
' An open request was issued.
If (nOpenFlag And lQueryType) <> 0 Then
' Retrieve content information for the normal proxy mode.
If nReverseProxy = 0 Then
ci.CacheProxyCallback = Callback
ci.varContext = varContext
CacheProxyServer.GetContentInformation(OriginUrl, _
PresentationContext, _
Nothing, _
Nothing, _
Me, _
ci)
Else
' Reverse proxy mode:
' Map the requested URL to the reverse proxy URL.
' The call to the user-defined GetContentInfo() searches
' a reverse proxy ContentInfo object for a
' "ReverseProxy" string.
ciRP = Nothing
GetContentInfo(OriginUrl, ciRP)
Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_BROADCAST
If (ciRP.ContentType And 1) = 0 Then
' Play the content as a broadcast stream.
Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_BROADCAST
Else
' Play the content on demand.
Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND
End If
' Create a content information context. The
' GetContentInfoContext() function is user-defined.
ContentInfoContext = Nothing
GetContentInfoContext(ci, ContentInfoContext)
' Call OnQueryCacheMissPolicy.
Callback.OnQueryCacheMissPolicy(0, _
Response, _
ciRP.CacheUrl, _
Nothing, _
ContentInfoContext, _
varContext)
End If
End If
If (nGCI And lQueryType) <> 0 Then
' Forward the request upstream.
Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_FORWARD_REQUEST
ContentInfoContext = Nothing
GetContentInfoContext(ci, ContentInfoContext)
Callback.OnQueryCacheMissPolicy(0, _
Response, _
OriginUrl, _
Nothing, _
ContentInfoContext, _
varContext)
End If
' A downstream cache proxy server propagated a remote
' cache proxy event. Forward the event to an upstream server.
If (lQueryType And WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_CACHE_EVENT) <> 0 Then
Callback.OnQueryCacheMissPolicy(0, _
Response, _
Nothing, _
Me, _
Nothing, _
varContext)
End If
Catch
Throw New COMException()
End Try
End Sub
Requirements
Reference: Add a reference to Microsoft.WindowsMediaServices.
Namespace: Microsoft.WindowsMediaServices.Interop.
Assembly: Microsoft.WindowsMediaServices.dll.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.