summaryrefslogtreecommitdiffstats
path: root/lib/private/Diagnostics
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-11-03 14:35:44 +0100
committerRobin Appelman <robin@icewind.nl>2016-11-03 16:00:28 +0100
commit95ac9f60ce4dda0302b108b9caf4e53f571db713 (patch)
tree538a5307a98c2912ca831819ec52e7f723ee6128 /lib/private/Diagnostics
parent1c52d878216a430c1214147ec1aa8e9aa0f6ad43 (diff)
downloadnextcloud-server-95ac9f60ce4dda0302b108b9caf4e53f571db713.tar.gz
nextcloud-server-95ac9f60ce4dda0302b108b9caf4e53f571db713.zip
Cap the number of queries we save in the query logger
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Diagnostics')
-rw-r--r--lib/private/Diagnostics/QueryLogger.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php
index a30f8c7b02a..5f2a061a910 100644
--- a/lib/private/Diagnostics/QueryLogger.php
+++ b/lib/private/Diagnostics/QueryLogger.php
@@ -23,6 +23,7 @@
namespace OC\Diagnostics;
+use OC\Cache\CappedMemoryCache;
use OCP\Diagnostics\IQueryLogger;
class QueryLogger implements IQueryLogger {
@@ -34,7 +35,15 @@ class QueryLogger implements IQueryLogger {
/**
* @var \OC\Diagnostics\Query[]
*/
- protected $queries = array();
+ protected $queries;
+
+ /**
+ * QueryLogger constructor.
+ */
+ public function __construct() {
+ $this->queries = new CappedMemoryCache(1024);
+ }
+
/**
* @param string $sql
@@ -65,6 +74,6 @@ class QueryLogger implements IQueryLogger {
* @return Query[]
*/
public function getQueries() {
- return $this->queries;
+ return $this->queries->getData();
}
}