Archived Forum Post

Index of archived forum posts

Question:

CkCache - what can it used for?

Sep 14 '16 at 03:01

Hi there,

is there a short documention or some examples for what the CkCache is for? On the first sight I can't realize the power of this class.

Best Regards Chris


Answer

A browser keeps a local cache of files, which have expiration, such that when a web page is fetched, all of the bits and pieces (JPG images, CSS style sheets, etc.) are not constantly re-fetched from the server. The local cache is checked and the data from the cache is used if not expired.

The Chilkat HTTP API does not use the Chilkat.Cache / CkCache object directly, but it uses the same underlying implementation. There are various Chilkat.Http properties, such as FetchFromCache, FreshnessAlgorithm, LMFactor, MinFreshPeriod, MaxFreshPeriod, NumCacheLevels, NumCacheRoots, etc., and there's an AddCacheRoot method for specifying directories where the cache(s) are to be located.

I suspect people don't use the caching capability of Chilkat.Http because they don't understand it's there. But it does exist and follows the HTTP protocol specifications for caching.

The purpose of the Chilkat.Cache object is to externalize the integrated HTTP caching functionality so that it can be used for any purpose, not just web pages or web content. Think of Chilkat.Cache as a file-based hash table, where the content can be anything, of any size, and if desired, content can be declared stale after some period of time such that an app would go and re-fetch the content from the primary source from time to time..


Answer

Thanks! Great function.