Partager via


Cache Hit with Expired Content

This section discusses how to define and implement a cache proxy policy for cached content that has expired. The following list identifies one possible way 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. The server calls QueryCache on the IWMSCacheProxy interface of the cache proxy plug-in.

  2. The plug-in determines that the content is cached but that it has expired. It 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.

  3. The server connects to the origin, retrieves content information, and responds to the plug-in 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 CompareContentInformation again.

  4. 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 plug-in can request that the server stream it to the client by calling OnQueryCache on the IWMSCacheProxyCallback interface and passing either WMS_CACHE_QUERY_PLAY_ON_DEMAND or WMS_CACHE_QUERY_PLAY_BROADCAST in the Response parameter. If the content is not current, the plug-in should pass WMS_CACHE_QUERY_MISS.

  5. The server then calls QueryCacheMissPolicy on the IWMSCacheProxy interface.

  6. 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.

  7. The server responds by calling OnGetContentInformation on the IWMSCacheProxyServerCallback interface.

  8. The plug-in examines the content information sent by the server, 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.

This is illustrated by the following diagram.

Illustration of cache proxy implementation for expired content.

Dd892424.wms8_cacheplugincreate_expired_final(en-us,VS.85).gif

See Also(General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)

  • IWMSCacheProxy::QueryCache

  • IWMSCacheProxy::QueryCacheMissPolicy

  • IWMSCacheProxyCallback::OnQueryCache

  • IWMSCacheProxyCallback::OnQueryCacheMissPolicy

  • IWMSCacheProxyServer::GetContentInformation

  • IWMSCacheProxyServer::DownloadContent

  • IWMSCacheProxyServerCallback::OnGetContentInformation