Share via


Overview of the Cache Proxy Process

banner art

Previous Next

Overview of the Cache Proxy Process

How you create a cache proxy plug-in is entirely up to you. This section introduces some of the basic functionality one can expect to find in a typical cache proxy plug-in. The section also identifies some of the interfaces used and the interplay between selected methods in the interfaces. The following list identifies possible ways that the server and cache proxy plug-in can interact when a client requests digital media. The actual interaction between a server and plug-in depends on how you implement the plug-in.

  1. When a client requests digital media, the server calls IWMSCacheProxy::QueryCache on the cache proxy plug-in to determine whether the content has been cached.
  2. If the requested content is not cached:
    • The plug-in can call OnQueryCache on the IWMSCacheProxyCallback interface and set the Response parameter to WMS_CACHE_QUERY_MISS.
    • The server then calls QueryCacheMissPolicy on the IWMSCacheProxy interface.
    • The plug-in can call GetContentInformation on the IWMSCacheProxyServer interface to request that the server connect to the origin and retrieve information about the content.
    • The server connects to the origin, retrieves content information, and responds to the plug-in by calling OnGetContentInformation on the IWMSCacheProxyServerCallback interface. If the origin server cannot be contacted, or the content is unavailable for any other reason, the cache proxy plug-in can perform protocol rollover by modifying the URL and calling GetContentInformation again.
    • If the content is found on the origin server, the plug-in examines the content information, chooses a policy, and sends it to the server by calling the OnQueryCacheMissPolicy on the IWMSCacheProxyCallback interface. For example, the plug-in can direct the server to disconnect the client, redirect the client to an alternate URL or proxy, proxy the content as a broadcast, proxy the content on demand, or forward the request to an upstream server. The plug-in can also call DownloadContent on the IWMSCacheProxyServer interface to request that the content be downloaded.
  3. If the requested content is cached:
    • The plug-in checks the expiration value to determine whether the content has expired. The expiration value is the length of time, from the moment at which the content was last cached, during which a server is permitted to stream the content. If the content has not expired, the plug-in can request the cache proxy server to stream it. If the content has expired, the cache plug-in calls CompareContentInformation on the IWMSCacheProxyServer interface to determine whether the content in the cache is out of date when compared to the content on the origin server.
    • The server responds by calling OnCompareContentInformation on the IWMSCacheProxyServerCallback interface. If the origin server cannot be contacted, or the content is unavailable for any other reason, the cache proxy plug-in can perform protocol rollover by modifying the URL and calling IWMSCacheProxyServer::CompareContentInformation again.
    • If the content is found, the plug-in can determine whether it is up to date when compared to the content on the origin server. If the content is still current, the server can stream it. If not, the server calls QueryCacheMissPolicy to discover from the plug-in the policy decision that must be implemented.

The preceding discussion is illustrated by the following diagram.

Illustration of general cache proxy process.

See Also(General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)

Previous Next