本文整理汇总了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));
}