Speeds up access of directories with large number of files.
* @return int
*/
public function getSize() {
-
- return OC_Filesystem::filesize($this->path);
+ $this->stat();
+ return $this->stat_cache['size'];
}
* @var string
*/
protected $path;
+ /**
+ * file stat cache
+ * @var array
+ */
+ protected $stat_cache;
/**
* Sets up the node, expects a full path name
}
-
+ /**
+ * 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
* @return int
*/
public function getLastModified() {
-
- return OC_Filesystem::filemtime($this->path);
+ $this->stat();
+ return $this->stat_cache['mtime'];
}