Export (0) Print
Expand All

BeginPersist Method

Begins to persist a cache response. This function is called whenever in the course of normal playback a Smooth Streaming object chunk, manifest, or key frame is received from the network and it might be useful to persist the item for later use.

Namespace:  Microsoft.Web.Media.SmoothStreaming
Assembly:  Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)

IAsyncResult BeginPersist(
	CacheRequest request,
	CacheResponse response,
	AsyncCallback callback,
	Object state


Type: Microsoft.Web.Media.SmoothStreaming..::..CacheRequest
A CacheRequest object.
Type: Microsoft.Web.Media.SmoothStreaming..::..CacheResponse
A CacheResponse object.
Type: System..::..AsyncCallback
A AsyncCallback delegate method to complete the operation.
Type: System..::..Object
A Object that represents state for the request.

Return Value

Type: System..::..IAsyncResult
An IAsyncResult object.

A Silverlight IIS Smooth Streaming Offline Cache Sample that demonstrates implementation of ISmoothStreamingCache is available on the IIS Website.

For documentation of the sample, see Cache Plug-in Implementation of ISmoothStreamingCache.

The following code shows an implementation of the BeginPersist(CacheRequest, CacheResponse, AsyncCallback, Object) method.

    public IAsyncResult BeginPersist(CacheRequest request, CacheResponse response, AsyncCallback callback, object state)
        state = false;
        CacheAsyncResult ar = new CacheAsyncResult();

        if (!keyUrls.ContainsKey(request.CanonicalUri.ToString()))
            state = true;
            ar.strUrl = request.CanonicalUri.ToString();
            ar.Complete(response, (bool)state);
            return ar;

        ar.Complete(null, true);
        return ar;


Supported in: 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.0

© 2014 Microsoft