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


PHP SPLoader::getLoaded方法代码示例

本文整理汇总了PHP中SPLoader::getLoaded方法的典型用法代码示例。如果您正苦于以下问题:PHP SPLoader::getLoaded方法的具体用法?PHP SPLoader::getLoaded怎么用?PHP SPLoader::getLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPLoader的用法示例。


在下文中一共展示了SPLoader::getLoaded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: serialize

 /**
  * Store object in to the cache
  * @param mixed $obj - object to store
  * @param string $type - type of object entry/category/section
  * @param int $id - id of the object
  * @param int $sid
  * @param bool $force
  * @return SPCache
  */
 public function &addObj($obj, $type, $id, $sid = 0, $force = false)
 {
     if ($this->enabled(!$force)) {
         static $startTime = 0;
         if (!$startTime && class_exists('Sobi')) {
             $start = Sobi::Reg('start');
             $startTime = $start[1];
         }
         // storing need time - if we are over five seconds - skip
         if (!defined('SOBIPRO_ADM') && !$force && microtime(true) - $startTime > 5) {
             return $this;
         }
         // it was the idea that if entry has been taken from cache, and do not reports any changes - it doesn't have to be stored again
         // but I'm not so sure if this is a good idea any longer
         // so let's skip it and see what's going to happen
         // poor guys from the testing team :P
         // Tue, Feb 19, 2013 14:09:52
         // it makes sense - otherwise the cache is being invalidated again and again
         // anyway stupid solution -  i have to reconsider it therefore @todo
         if ($type == 'entry') {
             // entry has to report if it should be re-validate
             if (!isset($this->_check[$type][$id]) || !$this->_check[$type][$id]) {
                 return $this;
             }
         }
         $id = (int) $id;
         $sid = (int) $sid;
         $sid = $sid ? $sid : $this->_section;
         $loaded = serialize(SPLoader::getLoaded());
         $lang = Sobi::Lang(false);
         $checksum = null;
         //md5( serialize( $obj ) );
         if ($this->_apc) {
             $var = array('obj' => $obj, 'classes' => $loaded);
             apc_store("com_sobipro_{$sid}_{$id}_{$type}_{$lang}", $var);
         }
         $obj = SPConfig::serialize($obj);
         $schecksum = md5($obj);
         // the command is a "REPLACE" so there is actually no reason for deleting it anyway
         // the "deleteObj" causing however a chain reaction which would delete lot of other things so it doesn't make any sense here
         //			$this->deleteObj( $type, $id, $sid );
         $this->Exec("BEGIN; REPLACE INTO objects ( type, validtime, id, sid, lang, params, checksum, schecksum, data, classes ) VALUES( '{$type}', '0', '{$id}', '{$sid}', '{$lang}', NULL, '{$checksum}', '{$schecksum}', '{$obj}', '{$loaded}' ); COMMIT;");
         $this->cleanJCache();
     }
     return $this;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:55,代码来源:cache.php


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