ISmoothStreamingCache.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)

Syntax

'Declaration

Function BeginPersist ( _
    request As CacheRequest, _
    response As CacheResponse, _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
'Usage

Dim instance As ISmoothStreamingCache
Dim request As CacheRequest
Dim response As CacheResponse
Dim callback As AsyncCallback
Dim state As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginPersist(request, _
    response, callback, state)
IAsyncResult BeginPersist(
    CacheRequest request,
    CacheResponse response,
    AsyncCallback callback,
    Object state
)
IAsyncResult^ BeginPersist(
    CacheRequest^ request, 
    CacheResponse^ response, 
    AsyncCallback^ callback, 
    Object^ state
)
abstract BeginPersist : 
        request:CacheRequest * 
        response:CacheResponse * 
        callback:AsyncCallback * 
        state:Object -> IAsyncResult 
function BeginPersist(
    request : CacheRequest, 
    response : CacheResponse, 
    callback : AsyncCallback, 
    state : Object
) : IAsyncResult

Parameters

Return Value

Type: System.IAsyncResult
An IAsyncResult object.

Examples

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;
    }

Version Information

Silverlight

Supported in: 5

Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

See Also

Reference

ISmoothStreamingCache Interface

Microsoft.Web.Media.SmoothStreaming Namespace