summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/Storage.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-09-02 15:41:59 +0200
committerRobin Appelman <robin@icewind.nl>2016-09-07 17:22:40 +0200
commite8e950a4d2972a4950e00a67cc8c1f0447701986 (patch)
tree17af82302f0000d88391fa4df5ecde419e991645 /lib/private/Files/Cache/Storage.php
parent1d04c9e307892c275f9fad64ef0ebe9bc10e0260 (diff)
downloadnextcloud-server-e8e950a4d2972a4950e00a67cc8c1f0447701986.tar.gz
nextcloud-server-e8e950a4d2972a4950e00a67cc8c1f0447701986.zip
more efficient querying of numeric storage ids
Diffstat (limited to 'lib/private/Files/Cache/Storage.php')
-rw-r--r--lib/private/Files/Cache/Storage.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php
index 8a076084ac5..b2bb8fd0078 100644
--- a/lib/private/Files/Cache/Storage.php
+++ b/lib/private/Files/Cache/Storage.php
@@ -40,10 +40,22 @@ namespace OC\Files\Cache;
* @package OC\Files\Cache
*/
class Storage {
+ /** @var StorageGlobal|null */
+ private static $globalCache = null;
private $storageId;
private $numericId;
/**
+ * @return StorageGlobal
+ */
+ public static function getGlobalCache() {
+ if (is_null(self::$globalCache)) {
+ self::$globalCache = new StorageGlobal(\OC::$server->getDatabaseConnection());
+ }
+ return self::$globalCache;
+ }
+
+ /**
* @param \OC\Files\Storage\Storage|string $storage
* @param bool $isAvailable
* @throws \RuntimeException
@@ -75,12 +87,10 @@ class Storage {
/**
* @param string $storageId
- * @return array|null
+ * @return array
*/
public static function getStorageById($storageId) {
- $sql = 'SELECT * FROM `*PREFIX*storages` WHERE `id` = ?';
- $result = \OC_DB::executeAudited($sql, array($storageId));
- return $result->fetchRow();
+ return self::getGlobalCache()->getStorageInfo($storageId);
}
/**