diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-06-08 20:26:08 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-19 23:13:21 +0200 |
commit | e728635c8adb1078b3465c7134821e70bef65fea (patch) | |
tree | 4eab9901275fdbd53fa40ddf56d5a2777fb6d4ed /lib/connector/sabre/node.php | |
parent | 4d627d66a18eea7a0ed2cebab61f3eba616b372e (diff) | |
download | nextcloud-server-e728635c8adb1078b3465c7134821e70bef65fea.tar.gz nextcloud-server-e728635c8adb1078b3465c7134821e70bef65fea.zip |
Add stat cache to OC_Connector_Sabre_Node and OC_Connector_Sabre_File
Speeds up access of directories with large number of files.
Diffstat (limited to 'lib/connector/sabre/node.php')
-rw-r--r-- | lib/connector/sabre/node.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index a7d1de8b953..b9a17e3b392 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -29,6 +29,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @var string */ protected $path; + /** + * file stat cache + * @var array + */ + protected $stat_cache; /** * Sets up the node, expects a full path name @@ -77,7 +82,14 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } - + /** + * Set the stat cache + */ + protected function stat() { + if (!isset($this->stat_cache)) { + $this->stat_cache = OC_Filesystem::stat($this->path); + } + } /** * Returns the last modification time, as a unix timestamp @@ -85,8 +97,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @return int */ public function getLastModified() { - - return OC_Filesystem::filemtime($this->path); + $this->stat(); + return $this->stat_cache['mtime']; } |