本文整理汇总了PHP中Cache::loadKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::loadKey方法的具体用法?PHP Cache::loadKey怎么用?PHP Cache::loadKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::loadKey方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listRss
function listRss()
{
header("Content-Type: application/xml; charset=UTF-8");
$location = Url::rss();
if ($match = Uri::match('^(.*?)$')) {
$location = ROOT_URL . $match[1];
$reLocation = base64_encode($location);
if ($loadData = Cache::loadKey($reLocation, 60)) {
$loadData = json_decode($loadData, true);
return $loadData;
}
}
$inputData = array('limitShow' => 15, 'limitPage' => 0);
if ($match = Uri::match('\\/page\\/(\\d+)')) {
$inputData['limitPage'] = $match[1];
}
if ($match = Uri::match('\\/category\\/(\\d+)')) {
$id = $match[1];
$inputData['where'] = "where catid='{$id}'";
}
if ($match = Uri::match('rss\\/products')) {
$loadData = Products::get($inputData);
} else {
$loadData = Post::get($inputData);
}
$reLocation = base64_encode($location);
Cache::saveKey($reLocation, json_encode($loadData));
return $loadData;
}
示例2: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "id,parentid,date_added,title,url,status,sort_order";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by id desc';
$result = array();
$command = "select {$selectFields} from " . Database::getPrefix() . "links {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/link/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
$inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
if (isset($row['title'])) {
$row['title'] = String::decode($row['title']);
}
if (isset($row['date_added'])) {
$row['date_addedFormat'] = Render::dateFormat($row['date_added']);
}
if (isset($row['url']) && !preg_match('/^http/i', $row['url'])) {
if (preg_match('/^\\/(.*?)$/i', $row['url'], $matches)) {
$tmp = $matches[1];
$row['urlFormat'] = System::getUrl() . $tmp;
}
}
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/link/' . $md5Query, serialize($result));
// end save
return $result;
}
示例3: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "userid,groupid,username,firstname,lastname,image,email,password,userdata,ip,verify_code,parentid,date_added,forgot_code,forgot_date";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by date_added desc';
$result = array();
$prefix = '';
$prefixall = Database::isPrefixAll();
if ($prefixall != false || $prefixall == 'no') {
$prefix = Database::getPrefix();
}
$command = "select {$selectFields} from " . $prefix . "users {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/user/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
// echo $queryCMD;die();
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
if (isset($row['date_added'])) {
$row['date_addedFormat'] = Render::dateFormat($row['date_added']);
}
if (isset($row['image'])) {
$row['imageFormat'] = self::getAvatar($row['image']);
}
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/user/' . $md5Query, serialize($result));
// end save
return $result;
}
示例4: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "userid,company,firstname,lastname,address_1,address_2,city,state,postcode,country,phone,fax";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by userid desc';
$result = array();
$command = "select {$selectFields} from " . Database::getPrefix() . "address {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/address/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
$inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
if (isset($row['title'])) {
$row['title'] = String::decode($row['title']);
}
if (isset($row['friendly_url'])) {
$row['url'] = self::url($row);
}
if (isset($row['date_added'])) {
$row['date_addedFormat'] = Render::dateFormat($row['date_added']);
}
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/address/' . $md5Query, serialize($result));
// end save
return $result;
}
示例5: addPlugin
public static function addPlugin($zonename, $inputData)
{
if (!isset($inputData['status']) || (int) $inputData['status'] == 0) {
return false;
}
$loadData = array();
if ($loadData = Cache::loadKey('listZones', -1)) {
$loadData = unserialize($loadData);
}
$loadData[$zonename] = $inputData;
Plugins::$listCaches = $loadData;
self::saveCache();
}
示例6: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "postid,catid";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by date_added desc';
$result = array();
$command = "select {$selectFields} from " . Database::getPrefix() . "post_categories {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/postcategory/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
$inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/postcategory/' . $md5Query, serialize($result));
// end save
return $result;
}
示例7: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "metaid,foldername,func,zonename,layoutname,layoutposition,content,status,type";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by metaid desc';
$result = array();
$command = "select {$selectFields} from plugins_meta {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : 15;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/pluginmeta/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/pluginmeta/' . $md5Query, serialize($result));
// end save
return $result;
}
示例8: ecommerce
public function ecommerce()
{
$post = array('alert' => '');
if (Request::has('btnSave')) {
System::saveSetting(Request::get('general'));
}
$data = array();
if (!($data = Cache::loadKey('systemSetting', -1))) {
$data = System::makeSetting();
} else {
$data = unserialize($data);
}
$post = $data;
$loadData = Currency::get();
$post['listCurrency'] = $loadData;
View::make('admincp/head', array('title' => 'Ecommerce Setting - ' . ADMINCP_TITLE));
self::makeContents('settingEcommerce', $post);
View::make('admincp/footer');
}
示例9: get
public static function get($queryStr = '', $timeLive = 15, $addPath = '')
{
// die(self::$enable);
if (self::$enable == 'no' || !isset($queryStr[1])) {
return false;
}
if (isset($addPath[1])) {
$fullPath = CACHES_PATH . 'dbcache/' . $addPath;
if (!is_dir($fullPath)) {
Dir::create($fullPath);
}
}
$queryStr = md5($queryStr);
// Cache::setPath(CACHES_PATH.'dbcache/');
if (!($loadData = Cache::loadKey('dbcache/' . $addPath . '/' . $queryStr, $timeLive))) {
return false;
}
// Cache::setPath(CACHES_PATH);
// self::$enable='no';
// $loadData=json_decode($loadData,true);
$loadData = unserialize($loadData);
// $loadData=unserialize(base64_decode($loadData));
return $loadData;
}
示例10: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "commentid,postid,type,fullname,email,parentid,date_added,status,content";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by commentid desc';
$result = array();
$command = "select {$selectFields} from " . Database::getPrefix() . "comments {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/comment/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
$inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
if (isset($row['fullname'])) {
$row['fullname'] = String::decode($row['fullname']);
}
if (isset($row['content'])) {
$row['content'] = String::decode($row['content']);
}
if (isset($row['date_added'])) {
$row['date_addedFormat'] = Render::dateFormat($row['date_added']);
}
if ($inputData['isHook'] == 'yes') {
if (isset($row['content'])) {
$row['content'] = Shortcode::toHTML($row['content']);
}
}
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/comment/' . $md5Query, serialize($result));
// end save
return $result;
}
示例11: getPermission
public static function getPermission($groupid, $keyName = '')
{
$prefix = '';
$prefixall = Database::isPrefixAll();
if ($prefixall != false || $prefixall == 'no') {
$prefix = Database::getPrefix();
}
$loadData = array();
if (!isset(self::$groupData['groupdata'])) {
if (!($loadData = Cache::loadKey($prefix . 'userGroup_' . $groupid, -1))) {
$loadData = self::get(array('cache' => 'no', 'where' => "where groupid='{$groupid}'"));
if (!isset($loadData[0]['groupid'])) {
return false;
}
$loadData[0]['groupdata'] = unserialize(self::lineToArray($loadData[0]['groupdata']));
$loadData = $loadData[0];
} else {
$loadData = unserialize($loadData);
$loadData['groupdata'] = unserialize($loadData['groupdata']);
}
self::$groupData = $loadData;
$groupData = $loadData['groupdata'];
} else {
$groupData = self::$groupData['groupdata'];
if ((int) $groupid != (int) self::$groupData['groupid']) {
$loadData = self::get(array('cache' => 'no', 'where' => "where groupid='{$groupid}'"));
if (!isset($loadData[0]['groupid'])) {
return false;
}
$loadData[0]['groupdata'] = unserialize(self::lineToArray($loadData[0]['groupdata']));
$groupData = $loadData[0]['groupdata'];
}
}
$value = isset($groupData[$keyName]) ? $groupData[$keyName] : false;
return $value;
}
示例12: get
public static function get($inputData = array())
{
$limitQuery = "";
$limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
$limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
$limitPage = (int) $limitPage > 0 ? $limitPage : 0;
$limitPosition = $limitPage * (int) $limitShow;
$limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
$limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
$field = "postid,title,catid,userid,parentid,image,sort_order,date_added,views,content,type,keywords,friendly_url,is_featured,date_featured,expires_date,rating,allowcomment,status";
$selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
$whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
$orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by postid desc';
$result = array();
$command = "select {$selectFields} from " . Database::getPrefix() . "post {$whereQuery}";
$command .= " {$orderBy}";
$queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
$queryCMD .= $limitQuery;
$cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
$cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
$md5Query = md5($queryCMD);
if ($cache == 'yes') {
// Load dbcache
$loadCache = Cache::loadKey('dbcache/system/post/' . $md5Query, $cacheTime);
if ($loadCache != false) {
$loadCache = unserialize($loadCache);
return $loadCache;
}
// end load
}
$query = Database::query($queryCMD);
if (isset(Database::$error[5])) {
return false;
}
$inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
if ((int) $query->num_rows > 0) {
while ($row = Database::fetch_assoc($query)) {
if (isset($row['title'])) {
$row['title'] = String::decode($row['title']);
}
if (isset($row['friendly_url'])) {
$row['url'] = self::url($row);
}
if (isset($row['content'])) {
$row['content'] = String::decode($row['content']);
// die($row['content']);
}
if (isset($row['date_added'])) {
$row['date_addedReal'] = $row['date_added'];
$row['date_added'] = Render::dateFormat($row['date_added']);
}
if ($inputData['isHook'] == 'yes') {
if (isset($row['content'])) {
$row['content'] = String::decode($row['content']);
$row['content'] = html_entity_decode($row['content']);
$row['content'] = Shortcode::loadInTemplate($row['content']);
$row['content'] = Shortcode::load($row['content']);
$row['content'] = Shortcode::toHTML($row['content']);
}
}
$result[] = $row;
}
} else {
return false;
}
// Save dbcache
Cache::saveKey('dbcache/system/post/' . $md5Query, serialize($result));
// end save
return $result;
}
示例13: loadCache
public static function loadCache($path)
{
if (self::$hasCache == 'yes') {
$md5Data = md5($path);
if ($loadCache = Cache::loadKey($md5Data, -1)) {
return $loadCache;
}
}
return false;
}