Elgg  Version 1.10
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ElggVolatileMetadataCache Class Reference

Public Member Functions

 saveAll ($entity_guid, array $values)
 Cache metadata for an entity. More...
 
 loadAll ($entity_guid)
 Get the metadata for an entity. More...
 
 markOutOfSync ($entity_guid)
 Declare that there may be fetch-able metadata names in storage that this cache doesn't know about. More...
 
 isSynchronized ($entity_guid)
 Have all the metadata for this entity been cached? More...
 
 save ($entity_guid, $name, $value, $allow_multiple=false)
 Cache a piece of metadata. More...
 
 load ($entity_guid, $name)
 Warning: You should always call isKnown() beforehand to verify that this function's return value should be trusted (otherwise a null return value is ambiguous). More...
 
 markUnknown ($entity_guid, $name)
 Forget about this metadata entry. More...
 
 isKnown ($entity_guid, $name)
 If true, load() will return an accurate value for this name. More...
 
 markEmpty ($entity_guid, $name)
 Declare that metadata under this name is known to be not fetch-able from storage. More...
 
 clear ($entity_guid)
 Forget about all metadata for an entity. More...
 
 flush ()
 Clear entire cache and mark all entities as out of sync. More...
 
 setIgnoreAccess ($ignore)
 Use this value instead of calling elgg_get_ignore_access(). More...
 
 unsetIgnoreAccess ()
 Tell the cache to call elgg_get_ignore_access() to determing access status. More...
 
 invalidateByOptions ($action, 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

 getIgnoreAccess ()
 Get the ignore access value. More...
 

Protected Attributes

 $values = array()
 
 $isSynchronized = array()
 
 $ignoreAccess = null
 

Detailed Description

Definition at line 11 of file ElggVolatileMetadataCache.php.

Member Function Documentation

ElggVolatileMetadataCache::clear (   $entity_guid)

Forget about all metadata for an entity.

Parameters
int$entity_guidThe GUID of the entity
Returns
void

Definition at line 183 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::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.

Parameters
array$guidsGUIDs of entities to examine
int$limitLimit in characters of all metadata (with ints casted to strings)
Returns
array

Definition at line 335 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::flush ( )

Clear entire cache and mark all entities as out of sync.

Returns
void

Definition at line 193 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::getIgnoreAccess ( )
protected

Get the ignore access value.

Returns
bool

Definition at line 225 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::invalidateByOptions (   $action,
array  $options 
)

Invalidate based on options passed to the global *_metadata functions.

Parameters
string$actionAction performed on metadata. "delete", "disable", or "enable"
array$optionsOptions passed to elgg_(delete|disable|enable)_metadata "guid" if given, invalidation will be limited to this entity "metadata_name" if given, invalidation will be limited to metadata with this name
Returns
void

Definition at line 242 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::isKnown (   $entity_guid,
  $name 
)

If true, load() will return an accurate value for this name.

Parameters
int$entity_guidThe GUID of the entity
string$nameThe metadata name
Returns
bool

Definition at line 157 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::isSynchronized (   $entity_guid)

Have all the metadata for this entity been cached?

Parameters
int$entity_guidThe GUID of the entity
Returns
bool

Definition at line 80 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::load (   $entity_guid,
  $name 
)

Warning: You should always call isKnown() beforehand to verify that this function's return value should be trusted (otherwise a null return value is ambiguous).

Parameters
int$entity_guidThe GUID of the entity
string$nameThe metadata name
Returns
array|string|int|null null = value does not exist

Definition at line 129 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::loadAll (   $entity_guid)

Get the metadata for an entity.

Parameters
int$entity_guidThe GUID of the entity
Returns
array

Definition at line 55 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::markEmpty (   $entity_guid,
  $name 
)

Declare that metadata under this name is known to be not fetch-able from storage.

Parameters
int$entity_guidThe GUID of the entity
string$nameThe metadata name
Returns
array

Definition at line 173 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::markOutOfSync (   $entity_guid)

Declare that there may be fetch-able metadata names in storage that this cache doesn't know about.

Parameters
int$entity_guidThe GUID of the entity
Returns
void

Definition at line 70 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::markUnknown (   $entity_guid,
  $name 
)

Forget about this metadata entry.

We don't want to try to guess what the next fetch from storage will return

Parameters
int$entity_guidThe GUID of the entity
string$nameThe metadata name
Returns
void

Definition at line 145 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::populateFromEntities (   $guids)

Populate the cache from a set of entities.

Parameters
int | array$guidsArray of or single GUIDs
Returns
void

Definition at line 269 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::save (   $entity_guid,
  $name,
  $value,
  $allow_multiple = false 
)

Cache a piece of metadata.

Parameters
int$entity_guidThe GUID of the entity
string$nameThe metadata name
array | int | string | null$valueThe metadata value. null means it is known that there is no fetch-able metadata under this name
bool$allow_multipleCan the metadata be an array
Returns
void

Definition at line 95 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::saveAll (   $entity_guid,
array  $values 
)

Cache metadata for an entity.

Parameters
int$entity_guidThe GUID of the entity
array$valuesThe metadata values to cache
Returns
void

Definition at line 42 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::setIgnoreAccess (   $ignore)

Use this value instead of calling elgg_get_ignore_access().

By default that function will be called.

This setting makes this component a little more loosely-coupled.

Parameters
bool$ignoreWhether to ignore access or not
Returns
void

Definition at line 207 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::unsetIgnoreAccess ( )

Tell the cache to call elgg_get_ignore_access() to determing access status.

Returns
void

Definition at line 216 of file ElggVolatileMetadataCache.php.

Member Data Documentation

ElggVolatileMetadataCache::$ignoreAccess = null
protected

Definition at line 33 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::$isSynchronized = array()
protected

Definition at line 28 of file ElggVolatileMetadataCache.php.

ElggVolatileMetadataCache::$values = array()
protected

Definition at line 20 of file ElggVolatileMetadataCache.php.


The documentation for this class was generated from the following file: