AbstractCachedResource

Abstract class for caching resources in memory. Stores compressed version as well.

Constructors

this
this()
Undocumented in source.

Members

Functions

getData
Data[] getData()

Get uncompressed data. The call may be expensive, result is cached (in uncompressedData).

getLastModified
SysTime getLastModified()

Return last modified time. Used for Last-Modified and If-Modified-Since headers. Called when cached data is invalidated; return value is cached. Returns current (invalidation) time by default.

getResponse
HttpResponse getResponse(HttpRequest request)

Used by application code.

invalidate
void invalidate()

Clear cached uncompressed and compressed data. An alternative to calling invalidate() from a subclass is to simply create a new class instance when data becomes stale (overhead is negligible).

newRequest
void newRequest()

Called every time a request is done. Can be used to check if cached data expired, and invalidate() it. By default is a no-op.

Variables

cachePolicy
CachePolicy cachePolicy;

Caching policy. To be set during subclass construction.

compressionLevel
int compressionLevel;

Zlib compression level

contentType
string contentType;

MIME content type. To be set during subclass construction.

Meta