Create an LRU cache for linkpreviewers

Create an LRU cache for linkpreviewers to stop the storage growing continuously as new links are made.
This commit is contained in:
James Graham
2024-08-27 08:15:03 +00:00
parent cc7f783b50
commit 6d77ed1e0e
2 changed files with 7 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
#pragma once
#include <QCache>
#include <QObject>
#include <QQmlEngine>
@@ -13,10 +14,9 @@
#include <Quotient/keyimport.h>
#endif
#include "linkpreviewer.h"
#include "models/threepidmodel.h"
class LinkPreviewer;
class NeoChatConnection : public Quotient::Connection
{
Q_OBJECT
@@ -222,7 +222,7 @@ private:
int m_badgeNotificationCount = 0;
QHash<QUrl, LinkPreviewer *> m_linkPreviewers;
QCache<QUrl, LinkPreviewer> m_linkPreviewers;
bool m_canCheckMutualRooms = false;
};