本文整理汇总了PHP中DataManager::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP DataManager::fetch方法的具体用法?PHP DataManager::fetch怎么用?PHP DataManager::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller_category
public function controller_category($args)
{
$vars["category"] = $args["category"];
if (is_string($vars["category"])) {
$categories = DataManager::fetch("db.demos.{$vars['category']}", "demo_categories", array("category" => $vars["category"]));
$vars["category"] = $categories[0];
}
return $this->GetComponentResponse("./category.tpl", $vars);
}
示例2: init
public static function init()
{
$cookieinfo = explode(",", $_COOKIE['fl-uid']);
$fluid = $cookieinfo[0];
$device = DataManager::fetch("db.session.{$deviceid}:nocache", "usersession.usersession", array("fl_uid" => $fluid));
if (count($device) == 1) {
self::set(preg_match("/^a:\\d+:{/", $device[0]["data"]) ? unserialize($device[0]["data"]) : json_decode($device[0]["data"]));
}
}
示例3: write
/**
* mysql session write handler.
* Persist the entire portion of $_SESSION["persist"] to DB.
* Refresh memcache with $_SESSION.
*
* @param string session id
* @param string data to write
*/
public function write($id, $data)
{
Profiler::StartTimer("SessionManager::write", 1);
// Save user, and all associated lists, settings, etc.
Profiler::StartTimer("SessionManager::write - save user");
$user = User::singleton();
$user->save();
Profiler::StopTimer("SessionManager::write - save user");
$pdata = $_SESSION["persist"];
strip_nulls($pdata);
// compare the persist data before and after for changes
$pdata_serialize = serialize($pdata);
//Logger::Warn($pdata_serialize);
//$data = $this->cache_obj->get($id);
$data = DataManager::fetch("memcache.session#{$id}", $id);
$pdata_before = $data["persist"];
$pdata_before_serialize = serialize($pdata_before);
// update the memcache with the entire $_SESSION
//$session_serialize = serialize($_SESSION);
//$this->cache_obj->set($id, $_SESSION, 0);
$data = DataManager::update("memcache.session#{$id}", $id, $_SESSION);
if (empty($pdata) || is_null($pdata)) {
$new_crc = 0;
} else {
$new_crc = strlen($pdata_serialize) . crc32($pdata_serialize);
}
if ($this->crc != $new_crc) {
// if the user does not have a record already, create one first
// NOTE from James - removed '&& (! $pdata["user"]["userid"]' from below, didn't seem to make sense...
if ($this->has_db_record == false) {
$this->create_new_persist_record();
// need to set the session cache again with we set the has_db_record param
//$session_serialize = serialize($_SESSION);
//$this->cache_obj->set($id, $_SESSION, 0, $this->session_cache_expire);
DataManager::update("memcache.session#{$id}", $id, $_SESSION);
} else {
$result = $this->data->QueryUpdate($this->sessionsource . "#{$this->fluid}", $this->sessiontable, array($this->fluid => array("data" => $pdata_serialize)), array("fl_uid" => $this->fluid));
Logger::Info("Updating userdata.usersession record for {$this->fluid}");
}
}
Profiler::StopTimer("SessionManager::write");
}