summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-16 10:43:53 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-16 10:43:53 +0200
commit0fb719dffe5c2240c97da6ecb37b4437b7ba0391 (patch)
treee4a33c05ae7cbfb39f42bae0eccbd6f52fb102ee
parent46f59b165e5bd1908509e8a62b67bf983cfd6224 (diff)
downloadnextcloud-server-0fb719dffe5c2240c97da6ecb37b4437b7ba0391.tar.gz
nextcloud-server-0fb719dffe5c2240c97da6ecb37b4437b7ba0391.zip
adding size() to the file cache
-rw-r--r--lib/cache/file.php18
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;