Класс Phalcon\Cache\Frontend\Output
реализует Phalcon\Cache\FrontendInterface
Позволяет кэшировать фрагменты вывода, полученные с помощью функций ob_*
*
* use Phalcon\Tag;
* use Phalcon\Cache\Backend\File;
* use Phalcon\Cache\Frontend\Output;
*
* // Create an Output frontend. Cache the files for 2 days
* $frontCache = new Output(
* [
* "lifetime" => 172800,
* ]
* );
*
* // Create the component that will cache from the "Output" to a "File" backend
* // Set the cache file directory - it's important to keep the "/" at the end of
* // the value for the folder
* $cache = new File(
* $frontCache,
* [
* "cacheDir" => "../app/cache/",
* ]
* );
*
* // Get/Set the cache file to ../app/cache/my-cache.html
* $content = $cache->start("my-cache.html");
*
* // If $content is null then the content will be generated for the cache
* if (null === $content) {
* // Print date and time
* echo date("r");
*
* // Generate a link to the sign-up action
* echo Tag::linkTo(
* [
* "user/signup",
* "Sign Up",
* "class" => "signup-button",
* ]
* );
*
* // Store the output into the cache file
* $cache->save();
* } else {
* // Echo the cached output
* echo $content;
* }
Методы
public __construct ([array $frontendOptions])
Конструктор Phalcon\Cache\Frontend\Output
public getLifetime ()
Возвращает срок действия кэша
public isBuffering ()
Проверка, буферизует ли фронтенд вывод
public start ()
Инициализирует фронтенд вывода. В данный момент ничего не делает
public string getContent ()
Возвращает кэшированное содержимое вывода
public stop ()
Останавливает фронтенд вывода
public beforeStore (mixed $data)
Сериализует данные перед сохранением
public afterRetrieve (mixed $data)
Десериализует данные после извлечения
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Cache_Frontend_Output.html