当前位置: 首页>>代码示例>>PHP>>正文


PHP OA_Delivery_Cache_store函数代码示例

本文整理汇总了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));
     }
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:19,代码来源:DeliveryCacheCommon.mol.test.php

示例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;
}
开发者ID:JackyKit,项目名称:revive-adserver,代码行数:21,代码来源:ti.php

示例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;
}
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:34,代码来源:cache.php


注:本文中的OA_Delivery_Cache_store函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。