Public Member Functions

CacheableBehavior Class Reference

CacheableBehavior class. More...

List of all members.

Public Member Functions

 setup (&$model, $settings=array())
 isCacheableOn (&$model)
 Is CacheableBehavior on?
 resetObjectsToClean (&$model)
 Reset self::objectsToClean.
 setObjectsToClean (&$model, $objectId, array $excludeIds=array())
 Set an array of object id to clean from cache starting from an object id.
 getObjectsToCleanById (&$model, $objectId, array $excludeIds=array())
 Return an array of object ids to clean from cache starting from $objectId.
 addObjectsToClean (&$model, $ids=array())
 Add object ids to delete from cache to self::objectsToClean array.
 clearCache (&$model, $objectId=null)
 Clear object cache.
 clearCacheByIds (&$model, array $objectIds)
 Clear cache of an array of objects calculating from $objectIds.
 beforeSave (&$model)
 beforeSave callback
 afterSave (&$model, $created)
 afterSave callback
 beforeDelete (&$model, $cascade)
 beforeDelete callback
 afterDelete (&$model)
 afterDelete callback

Detailed Description

CacheableBehavior class.

Used from BEObject to clean cached data when save or delete object Data are meant to be cached through BeObjectCache class in libs

Definition at line 31 of file cacheable.php.


Member Function Documentation

CacheableBehavior::addObjectsToClean ( &$  model,
ids = array() 
)

Add object ids to delete from cache to self::objectsToClean array.

Parameters:
Model $model
array $ids array of ids

Definition at line 138 of file cacheable.php.

Referenced by beforeSave(), clearCacheByIds(), and setObjectsToClean().

CacheableBehavior::afterDelete ( &$  model  ) 

afterDelete callback

Delete cached objects listed in self::objectsToClean

Parameters:
Model $model

Definition at line 266 of file cacheable.php.

References clearCache().

CacheableBehavior::afterSave ( &$  model,
created 
)

afterSave callback

If object already exists then delete cached objects listed in self::objectsToClean

Parameters:
Model $model
boolean $created

Definition at line 236 of file cacheable.php.

References clearCache().

CacheableBehavior::beforeDelete ( &$  model,
cascade 
)

beforeDelete callback

Prepare object ids that must to be cleaned from cache

Parameters:
Model $model
boolean $cascade
Returns:
boolean

Definition at line 252 of file cacheable.php.

References setObjectsToClean().

CacheableBehavior::beforeSave ( &$  model  ) 

beforeSave callback

Prepare object ids that must to be cleaned from cache

Parameters:
Model $model
Returns:
boolean

Definition at line 203 of file cacheable.php.

References addObjectsToClean(), and setObjectsToClean().

CacheableBehavior::clearCache ( &$  model,
objectId = null 
)

Clear object cache.

If objectId is passed start from it to obtain all object ids to delete from cache else use self::objectsToClean array that has to be build previously

Parameters:
Model $model
integer $objectId

Definition at line 166 of file cacheable.php.

References setObjectsToClean().

Referenced by afterDelete(), afterSave(), and clearCacheByIds().

CacheableBehavior::clearCacheByIds ( &$  model,
array $  objectIds 
)

Clear cache of an array of objects calculating from $objectIds.

Parameters:
Model $model
array $objectIds object ids from which calculate the objects to clean
See also:
CacheableBehavior::getObjectsToCleanById() to see which how object ids to clean are calculated

Definition at line 182 of file cacheable.php.

References addObjectsToClean(), clearCache(), getObjectsToCleanById(), and resetObjectsToClean().

CacheableBehavior::getObjectsToCleanById ( &$  model,
objectId,
array $  excludeIds = array() 
)

Return an array of object ids to clean from cache starting from $objectId.

Objects to clean:

  • object itself
  • parents
  • related objects
Parameters:
Model $model
integer $objectId
array $excludeIds object ids to not clean

Definition at line 104 of file cacheable.php.

Referenced by clearCacheByIds(), and setObjectsToClean().

CacheableBehavior::isCacheableOn ( &$  model  ) 

Is CacheableBehavior on?

Parameters:
Model $model
Returns:
boolean

Definition at line 62 of file cacheable.php.

CacheableBehavior::resetObjectsToClean ( &$  model  ) 

Reset self::objectsToClean.

Parameters:
Model $model

Definition at line 71 of file cacheable.php.

Referenced by clearCacheByIds(), and setObjectsToClean().

CacheableBehavior::setObjectsToClean ( &$  model,
objectId,
array $  excludeIds = array() 
)

Set an array of object id to clean from cache starting from an object id.

Parameters:
Model $model
integer $objectId
array $excludeIds object ids to not clean
See also:
CacheableBehavior::getObjectsToCleanById() to see which object ids are set

Definition at line 83 of file cacheable.php.

References addObjectsToClean(), getObjectsToCleanById(), and resetObjectsToClean().

Referenced by beforeDelete(), beforeSave(), and clearCache().


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:46 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus