PagesLoader::findCache()
Find pages and cache the result for specified period of time
Use this when you want to cache a slow or complex page finding operation so that it doesn’t have to be repated for every web request. Note that this only caches the find operation and not the loading of the found pages.
Available since version 3.0.218.
Example
$items = $pages->findCache("title%=foo"); // 60 seconds (default)
$items = $pages->findCache("title%=foo", 3600); // 1 hour
$items = $pages->findCache("title%=foo", "+1 HOUR"); // same as above
Usage
// basic usage
$items = $pagesLoader->findCache($selector);
// usage with all arguments
$items = $pagesLoader->findCache($selector, $expire = 60, array $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
$selector | string array Selectors | |
$expire (optional) | int string bool null | When the cache should expire, one of the following:
|
$options (optional) | array | Options to pass to
|
Return value
PageArray
array
PagesLoader methods and properties
API reference based on ProcessWire core version 3.0.251