straightsoft/contao-database_cache

此模块提供了将请求数据缓存到数据库的功能。

1.0.6 2017-12-01 15:29 UTC

This package is not auto-updated.

Last update: 2024-09-29 01:22:51 UTC


README

此模块提供了将任意值缓存到数据库的功能。

技术说明

在激活模块并定义contao设置中的最大缓存时间后,您可以使用以下代码(当然,如果已存在有效缓存结果,则会从缓存中检索)来获取特定请求的结果:

if (($strValue = DatabaseCache::getValue($strKey)) !== false)
{
    $strResult = $strValue;
}
else
{
    // do some logic in order to create $strResult
    $strResult = someFunction();
    DatabaseCache::cacheValue($strKey, $strResult);
}