Module:Cache/doc

This module provides a way of storing data between module invocations. Possible data types are strings, numbers, nil and tables. This is useful for templates that tend to appear multiple times on the same page. Do not use this for modules that only appear a single time per page. It will lead to performance decreases.

Warning
Metatables are not preserved. To work around this, this module automatically checks for a  method and converts the table to a string if possible.

cache.auto
The cache.auto function is the simplest way of implementing caching. It wraps the function supplying the value and automatically decides whether to execute the function or use a cached version.

It's parameters are:
 * 1) The function for which caching should be applied.
 * 2) A table holding the functions arguments.
 * 3) An optional prefix for the key under which the output will be stored (useful if multiple functions have the same arguments).

In pseudo-code it would look something like this:

Advanced
Use these functions if you want to manually implement caching in your module.

cache.set
Stores content. Logs the stored content and the variable name. Returns the content.

cache.get
Retrieves content. Returns the content.

Tests
ru:Модуль:Cache/doc zh:Module:Cache/doc ru:Модуль:Cache zh:Module:Cache