Modules/Groupware/Feeds/Account/Builder.php

Show: inherited
Table of Contents

\Conjoon_Modules_Groupware_Feeds_Account_Builder

Package:

This class can be used to implement a concrete strategy for returning objects out of the cache or directly from the data storage.

Providing a cache object when instantiating an object of this class, the get() method should return the object either directly out of the cache or from the data storage. Later look ups should use the cache, wheras the logic to determine whether the cache is still valid is done by the cache object itself.

Example for a concrete implementation of get():


 class User_Builder extends Conjoon_Builder {

 public function get($id)
 {
     $user = null;

     if (!$this->_cache->test($id)) {

         $user = new User;
         // expensive operations here

         $this->_cache->save($user, $id);
     } else {
         $user = $this->_cache->load($id);
     }

     return $user;

 }

}

Parent(s)
\Conjoon_Builder
Author
Thorsten-Suckow-Homberg  

Properties

Propertyprotectedstring  $_buildClass= ''Conjoon_Modules_Groupware_Feeds_Account_Dto''

mandatory, the class the builder has to use for creating cached objects
Default value'Conjoon_Modules_Groupware_Feeds_Account_Dto'Details
Type
string
Propertyprotected\Zend_Cache_Core  $_cache= 'null'
inherited

Inherited from: \Conjoon_Builder::$$_cache
Default valuenullDetails
Type
\Zend_Cache_Core
Inherited_from
\Conjoon_Builder::$$_cache  
Propertyprotected\Conjoon_BeanContext_Decoratable  $_model= 'null'
inherited

Inherited from: \Conjoon_Builder::$$_model
Default valuenullDetails
Type
\Conjoon_BeanContext_Decoratable
Inherited_from
\Conjoon_Builder::$$_model  
Propertyprotectedbool  $_noBuildClassNeeded= 'false'
inherited

Explicitely set this to true if you do not need a build class required before cache gets resolvedInherited from: \Conjoon_Builder::$$_noBuildClassNeeded
Default valuefalseDetails
Type
bool
Inherited_from
\Conjoon_Builder::$$_noBuildClassNeeded  
Propertyprotectedarray  $_validGetOptions= 'array('accountId')'

Default valuearray('accountId')Details
Type
array
Propertyprotectedarray  $_validTagOptions= 'array('userId')'

Default valuearray('userId')Details
Type
array

Methods

methodpublic__construct( \Zend_Cache_Core $cache = null,  $model = null ) : void
inherited

Constructor.

Inherited from: \Conjoon_Builder::__construct()
Parameters
Name Type Description
$cache \Zend_Cache_Core

The cache to use for retrieving or storing an object. If not supplied, this builder won't have any caching functionality.

$model

Conjoon_BeanContext_Decoratable

methodprotected_build( array $options, \Conjoon_BeanContext_Decoratable $model ) : Array

Returns either a cached list of feed accounts for a user, or the accounts out of the database.

It's purpose is to build the objects that have to be cached.

Parameters
Name Type Description
$options array

An associative array with the following key value/pairs: - userId: the id of the user to fetch all feed accounts for

$model \Conjoon_BeanContext_Decoratable
Returns
Type Description
Array an array with instances of Conjoon_Modules_Groupware_Feeds_Account_Model_Account_Dto
methodprotected_buildId( array $options ) : String

An abstract function which returns an id that can be used to identify cache objects.

Parameters
Name Type Description
$options array

An associative array with the following key value/pairs: - userId: the id of the user to fetch al twitter accounts for

Returns
Type Description
String
methodprotected_checkValidGetOptions(  $options ) : void
inherited

Validates the keys of the passed array against the whitelist of keys specified in $_validGetOptions.

Inherited from: \Conjoon_Builder::_checkValidGetOptions()

Throws an exception if there is a key missing in the passed argument that was specified in $_validGetOptions.

Parameters
Name Type Description
$options
methodprotected_checkValidTagOptions(  $options ) : void
inherited

Validates the keys of the passed array against the whitelist of keys specified in $_validTagOptions.

Inherited from: \Conjoon_Builder::_checkValidTagOptions()

Throws an exception if there is a key missing in the passed argument that was specified in $_validTagOptions.

Parameters
Name Type Description
$options
methodprotected_getTagList( array $options ) : Array

An abstract function which returns a numerical array with tag ids as their values.

IF this method does not return an empty array, those ids will be used to tag a cached item.

Parameters
Name Type Description
$options array

An associative array with the following key value/pairs: - accountId: The id of the related account this feed was retrieved for

Returns
Type Description
Array
methodpublicbuildId( array $options ) : String
inherited

A function which returns an id under which an object in the cache can be identified.

Inherited from: \Conjoon_Builder::buildId()

The returned key will be used to identify objects in the clean() and get() method of this class.

Parameters
Name Type Description
$options array

An associative array of options to use. If the _validGetOptions property is specified, the options will be checked against this property.

Returns
Type Description
String
methodpublicclean( string $type, array $options = array() ) : void
inherited

Cleans the cache based on the passed parameters.

Inherited from: \Conjoon_Builder::clean()
Parameters
Name Type Description
$type string

Any of Zend_Cache::CLEANING_MODE_ALL Zend_Cache::CLEANING_MODE_OLD Zend_Cache::CLEANING_MODE_MATCHING_TAG Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG

$options array

When using any tag related clean up, this array should hold all related tags for this operation

Details
See
\Zend_Cache::clean  
methodpubliccleanCacheForTags(  $options ) : void
inherited

Cleans the cache with all cached items that where tagged with the tags found in the return value of getTagList.

Inherited from: \Conjoon_Builder::cleanCacheForTags()
Parameters
Name Type Description
$options
Details
See
\clean  
See
\getTagList  
methodpublicget( array $options ) : mixed
inherited

Checks whether the keys specified in $_validGetOptions are available in $options. Throws an exception if that is not the case, otherwise calls the concrete implementation of _get.

Inherited from: \Conjoon_Builder::get()
Parameters
Name Type Description
$options array
Returns
Type Description
mixed
Throws
Exception Description
\Conjoon_Builder_Exception if the keys specified in $_validGetOptions are not specified in $options
Details
See
\_get  
methodpublicgetModel( ) : \Conjoon_BeanContext_Decoratable
inherited

Inherited from: \Conjoon_Builder::getModel()
Returns
Type Description
\Conjoon_BeanContext_Decoratable
methodprotectedgetTagList( array $options ) : Array
inherited

A function which returns an array with tag ids that can be used to tag a cached item.

Inherited from: \Conjoon_Builder::getTagList()
Parameters
Name Type Description
$options array

An associative array of options to use. If the _validTagOptions property is specified, the options will be checked against this property.

Returns
Type Description
Array
methodpublicremove( array $options ) : void
inherited

Removes an object from the cache, if available.

Inherited from: \Conjoon_Builder::remove()
Parameters
Name Type Description
$options array

An array of options which will be considered in buildId

Documentation was generated by DocBlox 0.18.1.