/** * 将数据设置进入 cache */ public function vSet($sId, $aItem, $bCheckMemSize) { KO_DEBUG >= 3 && Ko_Tool_Debug::VAddTmpLog('data/DBCache', 'vSet:' . $this->_sKind . ':' . $sId); $sKey = $this->_sGetCacheKey($sId); if ($this->_iMCacheTime) { $vbp = Ko_Tool_Enc::SEncode($aItem); $this->_oGetMCache()->bSet($sKey, $vbp, $this->_iMCacheTime); } if ($bCheckMemSize) { $this->_vCheckInProcMem(); } self::$s_aCache[$sKey] = $aItem; }
private function _vInsertInfo(&$arr, $oDao, $sHintId, $vAdmin) { $arr[$this->_sIdField] = $sHintId; if (strlen($this->_sKindField)) { $arr[$this->_sKindField] = $oDao->sGetTableName(); } if (strlen($this->_sAdminField)) { $arr[$this->_sAdminField] = is_array($vAdmin) ? Ko_Tool_Enc::SEncode($vAdmin) : $vAdmin; } if (strlen($this->_sIpField)) { $arr[$this->_sIpField] = Ko_Tool_Ip::SGetClientIP(); } $this->_oObsDao->aInsert($arr); }
public function aGetAll() { $ret = $this->mcacheDao->vGet(self::MC_ALL_MENU); if ($ret) { return Ko_Tool_Enc::ADecode($ret); } else { $oOption = new Ko_Tool_SQL(); $infos = $this->sqMenuDao->aGetList($oOption); if ($infos) { $infos = Ko_Tool_Utils::AObjs2map($infos, "id"); $this->mcacheDao->bSet(self::MC_ALL_MENU, Ko_Tool_Enc::SEncode($infos), 86400); } return $infos; } }
public function bSetObj($sKey, $oValue) { KO_DEBUG >= 4 && Ko_Tool_Debug::VAddTmpLog('data/LCache', 'bSetObj:' . $sKey); return $this->bSet($sKey, Ko_Tool_Enc::SEncode($oValue)); }
private function _vSaveCache($iOid, $aInfo) { if (strlen($this->_aConf['cache']) || strlen($this->_aConf['mc'])) { $cache = Ko_Tool_Enc::SEncode($aInfo); $aData = array('oid' => $iOid, 'cache' => $cache); $aUpdate = array('cache' => $cache); } if (strlen($this->_aConf['cache'])) { $cacheDao = $this->_aConf['cache'] . 'Dao'; $this->{$cacheDao}->aInsert($aData, $aUpdate); } if (strlen($this->_aConf['mc'])) { $key = $this->_sGetMCKey($iOid); $mcDao = $this->_aConf['mc'] . 'Dao'; $this->{$mcDao}->bSet($key, $cache); } }
private function _aGetAutoArr($sFilePath) { $templateDir = $this->_sGetTemplateDir(); $sFullname = Ko_View_Str::SGetAbsoluteFile($sFilePath, $templateDir); if (!is_file($sFullname)) { return array(); } $stime = filemtime($sFullname); $sHashFile = $this->_oSmarty->getCompileDir() . '/' . KO_VIEW_AUTOTAG . '_' . md5($sFullname); $htime = is_file($sHashFile) ? filemtime($sHashFile) : 0; if ($htime >= $stime) { $arr = Ko_Tool_Enc::ADecode(file_get_contents($sHashFile)); if (false !== $arr) { $rebuild = false; foreach ($arr[0] as $file) { $itime = is_file($file) ? filemtime($file) : time(); if ($htime < $itime) { $rebuild = true; break; } } if (!$rebuild) { return $arr[1]; } } } $aFilelist = array(); $sContent = file_get_contents($sFullname); $str = new Ko_View_Str($sContent); $aArr = $str->aParseArr($this->_oSmarty->left_delimiter, $this->_oSmarty->right_delimiter, $templateDir, $aFilelist); file_put_contents($sHashFile, Ko_Tool_Enc::SEncode(array($aFilelist, $aArr))); return $aArr; }
public function bReplaceObj($sKey, $oValue, $iExpire = 0) { KO_DEBUG >= 4 && Ko_Tool_Debug::VAddTmpLog('data/MemCache', 'bReplaceObj:' . $sKey . ':' . $iExpire); return $this->bReplace($sKey, Ko_Tool_Enc::SEncode($oValue), $iExpire); }
public function iSend2Mass($msgtype, array $content, $masstag = 'all') { $ctime = date('Y-m-d H:i:s'); $content = Ko_Tool_Enc::SEncode($content); $data = compact('msgtype', 'content', 'ctime'); $contentDao = $this->_aConf['content'] . 'Dao'; $msgid = $this->{$contentDao}->iInsert($data); $masstagDao = $this->_aConf['masstag'] . 'Dao'; $masstaginfo = $this->{$masstagDao}->aGet($masstag); if (false === ($masstagmsgids = unserialize($masstaginfo['msgids']))) { $masstagmsgids = array(); } $masstagmsgids[] = $msgid; $masstagmsgids = array_slice($masstagmsgids, -5); $update = array('msgids' => serialize($masstagmsgids)); $this->{$masstagDao}->iUpdate($masstag, $update); return $msgid; }
private function _vSetExif($sDest, $exif) { unset($exif['MakerNote']); unset($exif['UserComment']); $exifDao = $this->_aConf['exif'] . 'Dao'; $data = array('dest' => $sDest, 'exif' => Ko_Tool_Enc::SEncode($exif)); $update = array('exif' => Ko_Tool_Enc::SEncode($exif)); $this->{$exifDao}->aInsert($data, $update); }