From 0fb719dffe5c2240c97da6ecb37b4437b7ba0391 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20M=C3=BCller?= Date: Mon, 16 Sep 2013 10:43:53 +0200 Subject: [PATCH] adding size() to the file cache --- lib/cache/file.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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; -- 2.39.5