Elgg
Version 6.0
|
In memory cache of known metadata values stored by entity. More...
Public Member Functions | |
__construct (protected BaseCache $cache) | |
Constructor. More... | |
inject ($entity_guid, array $values=[]) | |
Set the visible metadata for an entity in the cache. More... | |
getAll ($entity_guid) | |
Get all entity metadata. More... | |
getSingle ($entity_guid, $name) | |
Get the metadata for a particular name. More... | |
getSingleId ($entity_guid, $name) | |
Get the metadata id 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... | |
getEntityMetadata ($entity_guid) | |
Returns loaded entity metadata. 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... | |
In memory cache of known metadata values stored by entity.
Definition at line 16 of file MetadataCache.php.
Elgg\Cache\MetadataCache::__construct | ( | protected BaseCache | $cache | ) |
Elgg\Cache\MetadataCache::clear | ( | $entity_guid | ) |
Forget about all metadata for an entity.
int | $entity_guid | The GUID of the entity |
Definition at line 158 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 276 of file MetadataCache.php.
Elgg\Cache\MetadataCache::getAll | ( | $entity_guid | ) |
Get all entity metadata.
int | $entity_guid | Entity guid |
Definition at line 62 of file MetadataCache.php.
Elgg\Cache\MetadataCache::getEntityMetadata | ( | $entity_guid | ) |
Returns loaded entity metadata.
int | $entity_guid | Entity guid |
Definition at line 191 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 92 of file MetadataCache.php.
Elgg\Cache\MetadataCache::getSingleId | ( | $entity_guid, | |
$name | |||
) |
Get the metadata id for a particular name.
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 128 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 |
For testing only
Definition at line 38 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 208 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 171 of file MetadataCache.php.
Elgg\Cache\MetadataCache::populateFromEntities | ( | $guids | ) |
Populate the cache from a set of entities.
mixed | ...$guids Array of entities or GUIDs |
Definition at line 223 of file MetadataCache.php.