cached
- Ariadne >
- Library >
- Ariadne 2.4 >
- Manuals >
- Programmers Reference >
- Classes >
- Object >
- PHP Methods >
(bool) cached($name, $nls="")
Returns TRUE if the cache image with the given name and language is available, false if not.
| Argument | Description |
|---|---|
| $name | The name of the private cache image. |
| $nls | The language of the private cache image. |
cached() checks whether a private cache image
with the given name is available for the current object. If it is, it will
display that cached image and return true. If it isn't, it will start a new
cache (using output buffering) and return false.
This function is most usefull in a intranet or personalized website environment. When generating pages for a specific person, it is impossible to use the public cache system. With this function you can create small building blocks, which can be cached, and use them to build the entire page. Instead of caching the entire page, only the common elements are cached. It also makes it possible to cache pages that must not become public. Since the cache is called only after the credentials of the viewer are checked, the cached image is available only to authorized users.
Note: You must always end a private
cache session with a call to the savecache() function. Otherwise Ariadne will complain.
Note: The cache only saves the output generated between the
cached() and savecache() call.
PHP example:
if(!$this ->cached("mycache")) {
echo "Cache this!";
$this->savecache();
}
PINP example:
if(!cached("mycache")) {
echo "Cache this!";
savecache();
}

