本文整理匯總了PHP中eZUser::getCacheDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZUser::getCacheDir方法的具體用法?PHP eZUser::getCacheDir怎麽用?PHP eZUser::getCacheDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZUser
的用法示例。
在下文中一共展示了eZUser::getCacheDir方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getUserCacheByUserId
/**
* Get User cache from cache file (usefull for sessionless users)
*
* @since 4.4
* @see eZUser::getUserCache()
* @param int $userId
* @return array
*/
protected static function getUserCacheByUserId($userId)
{
$userCache = null;
if (eZINI::instance()->variable('RoleSettings', 'EnableCaching') === 'true') {
$cacheFilePath = eZUser::getCacheDir($userId) . "/user-data-{$userId}.cache.php";
$cacheFile = eZClusterFileHandler::instance($cacheFilePath);
$userCache = $cacheFile->processCache(array('eZUser', 'retrieveUserCacheFromFile'), array('eZUser', 'generateUserCacheForFile'), null, self::userInfoExpiry(), $userId);
}
if ($userCache === null || $userCache instanceof eZClusterFileFailure) {
$userCache = self::generateUserCacheContent($userId);
}
return $userCache;
}
示例2: getUserCacheByUserId
/**
* Get User cache from cache file (usefull for sessionless users)
*
* @since 4.4
* @see eZUser::getUserCache()
* @param int $userId
* @return array
*/
protected static function getUserCacheByUserId($userId)
{
$cacheFilePath = eZUser::getCacheDir($userId) . "/user-data-{$userId}.cache.php";
$cacheFile = eZClusterFileHandler::instance($cacheFilePath);
return $cacheFile->processCache(array('eZUser', 'retrieveUserCacheFromFile'), array('eZUser', 'generateUserCacheForFile'), null, self::userInfoExpiry(), $userId);
}
示例3: getCacheFilename
/**
* Returns the filename for a cache file with user information
*
* @deprecated In 4.4.0
* @params int $userId
* @return string|false Filename of the cachefile, or false when the user should not be cached
*/
static function getCacheFilename($userId)
{
$ini = eZINI::instance();
$cacheUserPolicies = $ini->variable('RoleSettings', 'UserPolicyCache');
if ($cacheUserPolicies === 'enabled') {
return eZUser::getCacheDir($userId) . '/user-' . $userId . '.cache.php';
} else {
if ($cacheUserPolicies !== 'disabled') {
$cachableIDs = explode(',', $cacheUserPolicies);
if (in_array($userId, $cachableIDs)) {
return eZUser::getCacheDir($userId) . '/user-' . $userId . '.cache.php';
}
}
}
return false;
}
示例4: testNullUserCache
/**
* eZUser: do not generate cache content for invalid user
*
* @link http://issues.ez.no/22181
*/
public function testNullUserCache()
{
eZUser::instance($this->userId);
$cacheFilePath = eZUser::getCacheDir($this->userId) . "/user-data-{$this->userId}.cache.php";
$this->assertFalse(file_exists($cacheFilePath));
}