From: Thomas Müller Date: Mon, 16 Sep 2013 08:43:53 +0000 (+0200) Subject: adding size() to the file cache X-Git-Tag: v6.0.0alpha2~11^2~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0fb719dffe5c2240c97da6ecb37b4437b7ba0391;p=nextcloud-server.git adding size() to the file cache --- diff --git a/lib/cache/file.php b/lib/cache/file.php index 361138e4736..eed2637c981 100644 --- a/lib/cache/file.php +++ b/lib/cache/file.php @@ -40,6 +40,24 @@ class OC_Cache_File{ return $result; } + /** + * Returns the size of the stored/cached data + * + * @param $key + * @return int + */ + public function size($key) { + $result = 0; + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + if ($this->hasKey($key)) { + $storage = $this->getStorage(); + $result = $storage->filesize($key); + } + \OC_FileProxy::$enabled = $proxyStatus; + return $result; + } + public function set($key, $value, $ttl=0) { $storage = $this->getStorage(); $result = false;