PHP Класс Elgg\Cache\MetadataCache

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$session ElggSession
$values array The cached values (or null for known to be empty).

Открытые методы

Метод Описание
__construct ( ElggSession $session ) Constructor
clear ( integer $entity_guid ) : void Forget about all metadata for an entity. For safety this affects all access states.
clearAll ( ) : void Clear entire cache
filterMetadataHeavyEntities ( array $guids, integer $limit = 1024000 ) : array Filter out entities whose concatenated metadata values (INTs casted as string) exceed a threshold in characters. This could be used to avoid overpopulating the cache if RAM usage becomes an issue.
getSingle ( integer $entity_guid, string $name ) : array | string | integer | null Get the metadata for a particular name. Note, this can return an array of values.
inject ( integer $entity_guid, array $values ) : void Set the visible metadata for an entity in the cache
invalidateByOptions ( array $options ) : void Invalidate based on options passed to the global *_metadata functions
isLoaded ( integer $entity_guid ) : boolean If true, getSingle() will return an accurate values from the DB
populateFromEntities ( integer | array $guids ) : void Populate the cache from a set of entities

Защищенные методы

Метод Описание
getAccessKey ( ) : string Get a key to represent the access ability of the system. This is used to shard the cache array.

Описание методов

__construct() публичный Метод

Constructor
public __construct ( ElggSession $session )
$session ElggSession The session service

clear() публичный Метод

Forget about all metadata for an entity. For safety this affects all access states.
public clear ( integer $entity_guid ) : void
$entity_guid integer The GUID of the entity
Результат void

clearAll() публичный Метод

Clear entire cache
public clearAll ( ) : void
Результат void

filterMetadataHeavyEntities() публичный Метод

Filter out entities whose concatenated metadata values (INTs casted as string) exceed a threshold in characters. This could be used to avoid overpopulating the cache if RAM usage becomes an issue.
public filterMetadataHeavyEntities ( array $guids, integer $limit = 1024000 ) : array
$guids array GUIDs of entities to examine
$limit integer Limit in characters of all metadata (with ints casted to strings)
Результат array

getAccessKey() защищенный Метод

Get a key to represent the access ability of the system. This is used to shard the cache array.
protected getAccessKey ( ) : string
Результат string E.g. "ignored" or "123"

getSingle() публичный Метод

Warning: You should always call isLoaded() beforehand to verify that this function's return value can be trusted.
См. также: isLoaded
public getSingle ( integer $entity_guid, string $name ) : array | string | integer | null
$entity_guid integer The GUID of the entity
$name string The metadata name
Результат array | string | integer | null null = value does not exist

inject() публичный Метод

Note this does NOT invalidate any other part of the cache.
public inject ( integer $entity_guid, array $values ) : void
$entity_guid integer The GUID of the entity
$values array The metadata values to cache
Результат void

invalidateByOptions() публичный Метод

Invalidate based on options passed to the global *_metadata functions
public invalidateByOptions ( array $options ) : void
$options array Options passed to elgg_(delete|disable|enable)_metadata "guid" if given, invalidation will be limited to this entity
Результат void

isLoaded() публичный Метод

If true, getSingle() will return an accurate values from the DB
public isLoaded ( integer $entity_guid ) : boolean
$entity_guid integer The GUID of the entity
Результат boolean

populateFromEntities() публичный Метод

Populate the cache from a set of entities
public populateFromEntities ( integer | array $guids ) : void
$guids integer | array Array of or single GUIDs
Результат void

Описание свойств

$session защищенное свойство

protected ElggSession $session
Результат ElggSession

$values защищенное свойство

The cached values (or null for known to be empty).
protected array $values
Результат array