Elgg
Version 1.11
|
In memory cache of known metadata values stored by entity. More...
Public Member Functions | |
__construct (\ElggSession $session) | |
Constructor. More... | |
inject ($entity_guid, array $values) | |
Set the visible metadata for an entity in the cache. More... | |
getSingle ($entity_guid, $name) | |
Get the metadata for a particular name. More... | |
clear ($entity_guid) | |
Forget about all metadata for an entity. More... | |
isLoaded ($entity_guid) | |
If true, getSingle() will return an accurate values from the DB. More... | |
clearAll () | |
Clear entire cache. More... | |
invalidateByOptions (array $options) | |
Invalidate based on options passed to the global *_metadata functions. More... | |
populateFromEntities ($guids) | |
Populate the cache from a set of entities. More... | |
filterMetadataHeavyEntities (array $guids, $limit=1024000) | |
Filter out entities whose concatenated metadata values (INTs casted as string) exceed a threshold in characters. More... | |
Protected Member Functions | |
getAccessKey () | |
Get a key to represent the access ability of the system. More... | |
Protected Attributes | |
$values = array() | |
$session | |
In memory cache of known metadata values stored by entity.
private
Definition at line 9 of file MetadataCache.php.
Elgg\Cache\MetadataCache::__construct | ( | \ElggSession | $session | ) |
Constructor.
\ElggSession | $session | The session service |
Definition at line 28 of file MetadataCache.php.
Elgg\Cache\MetadataCache::clear | ( | $entity_guid | ) |
Forget about all metadata for an entity.
For safety this affects all access states.
int | $entity_guid | The GUID of the entity |
Definition at line 77 of file MetadataCache.php.
Elgg\Cache\MetadataCache::clearAll | ( | ) |
Elgg\Cache\MetadataCache::filterMetadataHeavyEntities | ( | array | $guids, |
$limit = 1024000 |
|||
) |
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.
array | $guids | GUIDs of entities to examine |
int | $limit | Limit in characters of all metadata (with ints casted to strings) |
Definition at line 202 of file MetadataCache.php.
|
protected |
Get a key to represent the access ability of the system.
This is used to shard the cache array.
Definition at line 229 of file MetadataCache.php.
Elgg\Cache\MetadataCache::getSingle | ( | $entity_guid, | |
$name | |||
) |
Get the metadata for a particular name.
Note, this can return an array of values.
Warning: You should always call isLoaded() beforehand to verify that this function's return value can be trusted.
int | $entity_guid | The GUID of the entity |
string | $name | The metadata name |
Definition at line 60 of file MetadataCache.php.
Elgg\Cache\MetadataCache::inject | ( | $entity_guid, | |
array | $values | ||
) |
Set the visible metadata for an entity in the cache.
Note this does NOT invalidate any other part of the cache.
int | $entity_guid | The GUID of the entity |
array | $values | The metadata values to cache |
private For testing only
Definition at line 43 of file MetadataCache.php.
Elgg\Cache\MetadataCache::invalidateByOptions | ( | array | $options | ) |
Invalidate based on options passed to the global *_metadata functions.
array | $options | Options passed to elgg_(delete|disable|enable)_metadata "guid" if given, invalidation will be limited to this entity |
Definition at line 114 of file MetadataCache.php.
Elgg\Cache\MetadataCache::isLoaded | ( | $entity_guid | ) |
If true, getSingle() will return an accurate values from the DB.
int | $entity_guid | The GUID of the entity |
Definition at line 89 of file MetadataCache.php.
Elgg\Cache\MetadataCache::populateFromEntities | ( | $guids | ) |
Populate the cache from a set of entities.
int | array | $guids | Array of or single GUIDs |
Definition at line 128 of file MetadataCache.php.
|
protected |
Definition at line 21 of file MetadataCache.php.
|
protected |
Definition at line 16 of file MetadataCache.php.