PHP Class Elgg\Cache\EntityCache

Show file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( ElggSession $session, MetadataCache $metadata_cache ) Constructor
clear ( ) : void Clear the entity cache
disableCachingForEntity ( integer $guid ) : void Remove this entity from the entity cache and make sure it is not re-added
enableCachingForEntity ( integer $guid ) : void Allow this entity to be stored in the entity cache
get ( integer $guid ) : ElggEntity | false Retrieve a entity from the cache.
getByUsername ( string $username ) : ElggUser | false Returns cached user entity by username
remove ( integer $guid ) : void Invalidate this class's entry in the cache.
set ( ElggEntity $entity ) : void Cache an entity.

Method Details

__construct() public method

Constructor
public __construct ( ElggSession $session, MetadataCache $metadata_cache )
$session ElggSession Session
$metadata_cache MetadataCache MD cache

clear() public method

Clear the entity cache
public clear ( ) : void
return void

disableCachingForEntity() public method

Remove this entity from the entity cache and make sure it is not re-added
public disableCachingForEntity ( integer $guid ) : void
$guid integer The entity guid
return void

enableCachingForEntity() public method

Allow this entity to be stored in the entity cache
public enableCachingForEntity ( integer $guid ) : void
$guid integer The entity guid
return void

get() public method

Retrieve a entity from the cache.
public get ( integer $guid ) : ElggEntity | false
$guid integer The GUID
return ElggEntity | false false if entity not cached, or not fully loaded

getByUsername() public method

Returns cached user entity by username
public getByUsername ( string $username ) : ElggUser | false
$username string Username
return ElggUser | false

remove() public method

Invalidate this class's entry in the cache.
public remove ( integer $guid ) : void
$guid integer The entity guid
return void

set() public method

Cache an entity.
public set ( ElggEntity $entity ) : void
$entity ElggEntity Entity to cache
return void