diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-16 10:43:53 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-16 10:43:53 +0200 |
commit | 0fb719dffe5c2240c97da6ecb37b4437b7ba0391 (patch) | |
tree | e4a33c05ae7cbfb39f42bae0eccbd6f52fb102ee | |
parent | 46f59b165e5bd1908509e8a62b67bf983cfd6224 (diff) | |
download | nextcloud-server-0fb719dffe5c2240c97da6ecb37b4437b7ba0391.tar.gz nextcloud-server-0fb719dffe5c2240c97da6ecb37b4437b7ba0391.zip |
adding size() to the file cache
-rw-r--r-- | lib/cache/file.php | 18 |
1 files changed, 18 insertions, 0 deletions
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; |