/** * (non-PHPdoc) * @see OpenApi_OAuth_Storage_Interface::unsetRefreshToken() */ public function unsetRefreshToken($refreshToken) { return $this->_memcache->delete($this->_makeRefreshTokenKey($refreshToken)); }
/** * Delete item from the storage * * @param string $key */ public function delete($key) { return $this->_storage->delete($key); }
/** * 刷新im服务器缓存 * * @param string $orgId */ protected function _refreshCastCache($orgId) { /* @var $db Zend_Db_Adapter_Abstract */ $db = Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_MD); // 读取所有用户列表 $userSql = "SELECT * FROM ((" . "SELECT u.org_id, u.`status`, u.dept_id, u.user_id, u.unique_id, ui.true_name, ui.pinyin, ui.update_time, 0 AS usertype " . "FROM md_user AS u " . "LEFT JOIN md_user_info AS ui ON u.org_id = ui.org_id AND u.user_id = ui.user_id " . "WHERE u.org_id = :orgid) UNION ALL (" . "SELECT org_id, 1 AS `status`, '' AS dept_id, user_id, unique_id, true_name, pinyin, update_time, 1 AS usertype FROM v_cast_common_user)) AS T"; $users = $db->fetchAll($userSql, array('orgid' => $orgId)); /* // 读取所有部门 $deptSql = "SELECT org_id, dept_id, dept_name, IF(parent_dept_id = '^root', NULL, parent_dept_id) AS parent_dept_id, order_num " . "FROM md_department WHERE org_id = :orgid AND dept_id <> '^root'"; $depts = $db->fetchAll($deptSql, array('orgid' => $orgId)); // 读取组织所有匹配规则 $castUserSql = "SELECT org_id, owner_id, user_id FROM md_cast_disable_user WHERE org_id = :orgid"; $castDeptSql = "SELECT org_id, owner_id, dept_id FROM md_cast_disable_dept WHERE org_id = :orgid"; $res = $db->query($castUserSql, array('orgid' => $orgId)); $castUsers = array(); while (($row = $res->fetch())) { $castUsers[$row['owner_id']][] = $row['user_id']; } $res->closeCursor(); $res = $db->query($castDeptSql, array('orgid' => $orgId)); $castDepts = array(); while (($row = $res->fetch())) { $castDepts[$row['owner_id']][] = $row['dept_id']; } $res->closeCursor(); unset($res); */ // 更新各用户好友列表 foreach ($users as $user) { // 跳过公共用户 if (1 == $user['usertype']) { continue; } /* $d = isset($castDepts[$user['user_id']]) ? $castDepts[$user['user_id']] : array(); $u = isset($castUsers[$user['user_id']]) ? $castUsers[$user['user_id']] : array(); // 更新当前用户部门列表缓存 $contentDepts = array(); foreach ($depts as $dept) { if (in_array($dept['dept_id'], $d)) { continue ; } $str = "<item id='{$dept['dept_id']}' name='{$dept['dept_name']}' orgid='{$dept['org_id']}'"; if (!empty($dept['parent_dept_id'])) { $str .= " parentid='{$dept['parent_dept_id']}'"; } $str .= ' />'; $contentDepts[] = $str; } $contentDepts = '<dept>' . implode('', $contentDepts) . '</dept>'; $this->_memcache->set('im_' . $orgId . '_' . $user['user_id'] . '_depts', $contentDepts, null, null, true); // 更新用户列表缓存 $contentUsers = array(); foreach ($users as $du) { if (in_array($du['user_id'], $u) && 0 == $du['usertype']) { continue ; } $contentUsers[] = "<user userid='{$du['user_id']}' usertype='{$du['usertype']}' orgid='{$du['org_id']}' deptid='{$du['dept_id']}' " . "name='{$du['true_name']}' host='{$du['org_id']}' updatetime='{$du['update_time']}' satus='{$du['status']}' />"; } $contentUsers = '<Roster>' . implode('', $contentUsers) . '</Roster>'; $this->_memcache->set('im_' . $orgId . '_' . $user['user_id'] . '_roster', $contentUsers, null, null, true); $this->_memcache->delete('TUDU-APP-ROLES-' . $user['user_id'] . '@' . $orgId); */ $this->_memcache->delete('im_' . $user['org_id'] . '_' . $user['user_id'] . '_depts'); $this->_memcache->delete('im_' . $user['org_id'] . '_' . $user['user_id'] . '_roster'); $this->getLogger()->debug("refresh cache of {$user['user_id']}@{$orgId}"); //unset($conentDepts, $contentUsers, $d, $u); } //unset($users, $castUsers, $castDepts, $depts); }
/** * * 更新用户设置缓存 */ public function updateSetting() { $key = self::CACHE_KEY_USER . strtolower($this->_attrs['username']); self::$_memcache->delete($key); }