Caching works automatically and without any further setup. The plugin handles the caching headers received from the server in the response and adds additional headers to the request to check the cached content's freshness.

Headers

Caching uses the following headers:

Flow-chart about caching:

Caching Explained

Disable caching

There's quite a few ways to disable caching. It can be done globally with the BESTHTTP_DISABLE_CACHING define or by setting HTTPManager.IsCachingDisabled to true before any HTTPRequest instantiation:

HTTPManager.IsCachingDisabled = true;

It can be disabled per-request by setting the HTTPRequest's DisableCache property to true:

var request = new HTTPRequest(new Uri("..."), ImageDownloaded);
request.DisableCache = true;
request.Send();

HTTPRequest:

HTTPResponse:

Maintainence

Although caching is automatic we have some control over it, or we can gain some info using the public functions of the HTTPCacheService class:

// Delete cache entries that weren’t accessed in the last two weeks, then
// delete entries to keep the size of the cache under 50 megabytes, starting with the oldest.
HTTPCacheService.BeginMaintainence(new HTTPCacheMaintananceParams(TimeSpan.FromDays(14), 50 * 1024 * 1024));