Class wwCache

The wwCache class provides a simple caching mechanisms for strings. Caching allows you to generate output once, store it to the cache and then attempt to retrieve it from the cache if it already exists the next time the same content is required.

Cached items are accessible by key and have an expiration, which allows for timing the availability of cached content to a timeout period that content is valid.

Caching is powerful for storing previously generated output - complete HTML repsonses, or HTML fragments of a page. XML results or fragments of results. You can even cache binary content like the result of a PDF output generation for example. Anything that can be represented as a string can be cached.

Caching can provide huge performance gains for your applications by avoiding regenerating output and not requiring you to go back to the database to re-run complex queries. Instead results are returned from a single indexed key of the cache cursor or table.



The cache is implemented as a cursor, so the contents of the cache is not permanently stored on disk, but stored in temporary files.

Category list items are case sensitive

Class Members



This method adds an item to the cache.

o.AddItem(lcKey as String, lcValue as String, lnTimeoutSeconds as Integer)


Removes all expired entries from the cache data file.



Retrieves an item by key from the cache. Item is returned if it exists and not expired.

o.GetItem(lcKey as String)


Determines whether an item exists in the cache or not.

o.IsCached(lcKey as String)


Opens the cache cursor. Either creates it or just uses it if already open.

The wwCache class uses a cursor, so each instance of Web Connection uses the same



Packs and reindexes the file specified in the cFixedFileName. This method works only if the cFixedFilename property is set and only if an exclusive lock can be set on the table.



This method removes an entry from the Cache.



The name of the cursor used for caching.



The default timeout for the cache in seconds.


Assembly: wwCache.prg

See also:

How wwCache works | When and How to use Caching

© West Wind Technologies, 1996-2022 • Updated: 03/14/16
Comment or report problem with topic