IWMSCacheProxyPlugin.PreStuff (Visual Basic .NET)

banner art

Previous Next

IWMSCacheProxyPlugin.PreStuff (Visual Basic .NET)

The PreStuff method fills a cache with content.

Syntax

  IWMSCachePlugin
  .PreStuff(
  strOriginURL As String, 
  strSourcePath As String, 
  lExpiration As Integer, 
  lBitRate As Integer, 
 lRemoteEventFlags As Integer
)

Parameters

strOriginURL

[in] String specifying the URL that the client must use to request the content. The cache manager does not require a scheme, such as RTSP, to be specified in the URL. If one is specified, it is ignored. For the cache manager you need to specify only the server name and the path to the content. Depending on the implementation, a cache plug-in may or may not require a scheme.

strSourcePath

[in] String that contains the path to the content. Valid examples are c:\movies\movies.wmv and \\servername\directory\movie.wmv. This is an optional parameter. If no value is specified, the first parameter is used.

lExpiration

[in] Integer containing the expiration value in seconds for the cached content. The default value is –1, which indicates that the content never expires.

lBitRate

[in] Integer containing the bit rate at which the file should be downloaded. The default value is zero, which indicates that content should be downloaded in real time. A value of 0xFFFFFFFF indicates that content should be downloaded as fast as possible.

lRemoteEventFlags

[in] Integer containing the remote event flags, WMS_CACHE_REMOTE_EVENT_FLAGS, indicating the remote cache events that should be propagated to the origin server. If these flags are set by this argument and content is prestuffed from a Windows Media server, the values obtained from the Windows Media server will be used. The default value is zero.

Return Values

This method does not return a value.

Remarks

If you use the PreStuff method to fill a cache, a proxy server can start streaming content immediately rather than first downloading it. This minimizes bandwidth. It is an asynchronous call. A slower than real-time bit rate can be specified.

For internal events, WMS_EVENT_CACHE_PRESTUFF_COMPLETE is sent on completion of the download to the cache. For WMI events, the PreStuff Complete sub event in the WMS_Cache_Event class is sent on completion of the download.

Example Code

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub FillCache()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Plugins As IWMSPlugins
    Dim CacheProxyPlugin As IWMSCacheProxyPlugin
    Dim strOriginURL As String

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlugins object
    ' containing cache proxy plug-ins.
    Plugins = Server.CacheProxy

    ' Retrieve the IWMSCacheProxyPlugin object.
    CacheProxyPlugin = Plugins.Item(0)

    ' Enable the cache proxy plug-in.
    CacheProxyPlugin.Enabled = True

    ' Prestuff the content cache to decrease the relay
    ' time to the client.
    strOriginURL = "https://distribution_server/welcome1.wmv"
    CacheProxyPlugin.PreStuff(strOriginURL)

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
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 family, Windows Server 2008 family.

See Also

Previous Next