mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
init class variables for internal cache, add method to clear cache
This commit is contained in:
parent
16e48bbb16
commit
674002c02f
|
@ -79,22 +79,22 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
protected $_date;
|
protected $_date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_Folder
|
* @var SeedDMS_Core_Folder cached parent folder
|
||||||
*/
|
*/
|
||||||
protected $_parent;
|
protected $_parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_User
|
* @var SeedDMS_Core_User cached owner of folder
|
||||||
*/
|
*/
|
||||||
protected $_owner;
|
protected $_owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_Folder[]
|
* @var SeedDMS_Core_Folder[] cached array of sub folders
|
||||||
*/
|
*/
|
||||||
protected $_subFolders;
|
protected $_subFolders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_Document[]
|
* @var SeedDMS_Core_Document[] cache array of child documents
|
||||||
*/
|
*/
|
||||||
protected $_documents;
|
protected $_documents;
|
||||||
|
|
||||||
|
@ -127,6 +127,25 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
||||||
$this->_defaultAccess = $defaultAccess;
|
$this->_defaultAccess = $defaultAccess;
|
||||||
$this->_sequence = $sequence;
|
$this->_sequence = $sequence;
|
||||||
$this->_notifyList = array();
|
$this->_notifyList = array();
|
||||||
|
/* Cache */
|
||||||
|
$this->clearCache();
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear cache of this instance.
|
||||||
|
*
|
||||||
|
* The result of some expensive database actions (e.g. get all subfolders
|
||||||
|
* or documents) will be saved in a class variable to speed up consecutive
|
||||||
|
* calls of the same method. If a second call of the same method shall not
|
||||||
|
* use the cache, then it must be cleared.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function clearCache() { /* {{{ */
|
||||||
|
$this->_parent = null;
|
||||||
|
$this->_owner = null;
|
||||||
|
$this->_subFolders = null;
|
||||||
|
$this->_documents = null;
|
||||||
|
$this->_accessList = null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user