init class variables for internal cache, add method to clear cache

This commit is contained in:
Uwe Steinmann 2021-09-22 09:46:20 +02:00
parent 16e48bbb16
commit 674002c02f

View File

@ -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;
@ -126,7 +126,26 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$this->_inheritAccess = $inheritAccess; $this->_inheritAccess = $inheritAccess;
$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;
} /* }}} */ } /* }}} */
/** /**