本文整理汇总了PHP中OA_Delivery_Cache_store函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Delivery_Cache_store函数的具体用法?PHP OA_Delivery_Cache_store怎么用?PHP OA_Delivery_Cache_store使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Delivery_Cache_store函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_invalidateAll
/**
* Method tests invalidateAll method
*
*/
function test_invalidateAll()
{
for ($i = 0; $i < 5; $i++) {
$filename = 'testname' . $i;
OA_Delivery_Cache_store($filename, $i);
}
for ($i = 0; $i < 5; $i++) {
$this->assertEqual($i, OA_Delivery_Cache_fetch('testname' . $i));
}
$result = $this->oDeliveryCacheCommon->invalidateAll();
$this->assertTrue($result);
for ($i = 0; $i < 5; $i++) {
$this->assertFalse(OA_Delivery_Cache_fetch('testname' . $i));
}
}
示例2: MAX_cacheCheckIfMaintenanceShouldRun
function MAX_cacheCheckIfMaintenanceShouldRun($cached = true)
{
$interval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] * 60;
$delay = intval($GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] / 12 * 60);
$now = MAX_commonGetTimeNow();
$today = strtotime(date('Y-m-d'), $now);
$nextRunTime = $today + (floor(($now - $today) / $interval) + 1) * $interval + $delay;
if ($nextRunTime - $now > $interval) {
$nextRunTime -= $interval;
}
$cName = OA_Delivery_Cache_getName(__FUNCTION__);
if (!$cached || ($lastRunTime = OA_Delivery_Cache_fetch($cName)) === false) {
MAX_Dal_Delivery_Include();
$lastRunTime = OA_Dal_Delivery_getMaintenanceInfo();
if ($lastRunTime >= $nextRunTime - $delay) {
$nextRunTime += $interval;
}
OA_Delivery_Cache_store($cName, $lastRunTime, false, $nextRunTime);
}
return $lastRunTime < $nextRunTime - $interval;
}
示例3: MAX_cacheCheckIfMaintenanceShouldRun
/**
* Check if maintenance should run using cached information
*
* This function gets maintenance's last run info
*
* @param boolean $cached Should a cache lookup be performed?
* @return array The array of tracker properties
*/
function MAX_cacheCheckIfMaintenanceShouldRun($cached = true)
{
// Default delay is 5 minutes
$interval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] * 60;
$delay = intval($GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] / 12 * 60);
$now = MAX_commonGetTimeNow();
$today = strtotime(date('Y-m-d'), $now);
$nextRunTime = $today + (floor(($now - $today) / $interval) + 1) * $interval + $delay;
// Adding the delay could shift the time to the next operation interval,
// make sure to fix it in case it happens
if ($nextRunTime - $now > $interval) {
$nextRunTime -= $interval;
}
$cName = OA_Delivery_Cache_getName(__FUNCTION__);
if (!$cached || ($lastRunTime = OA_Delivery_Cache_fetch($cName)) === false) {
MAX_Dal_Delivery_Include();
$lastRunTime = OA_Dal_Delivery_getMaintenanceInfo();
// Cache until the next operation interval if scheduled maintenance was run
// during the delay
if ($lastRunTime >= $nextRunTime - $delay) {
$nextRunTime += $interval;
}
OA_Delivery_Cache_store($cName, $lastRunTime, false, $nextRunTime);
}
return $lastRunTime < $nextRunTime - $interval;
}