mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
Added Min/Max values for cache size
This commit is contained in:
parent
81bf1e4f53
commit
e70e435dcc
2 changed files with 6 additions and 2 deletions
|
@ -166,6 +166,7 @@ Resource::~Resource() {
|
|||
if (_reply) {
|
||||
ResourceCache::requestCompleted(this);
|
||||
delete _reply;
|
||||
_reply = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@ class QTimer;
|
|||
class Resource;
|
||||
|
||||
static constexpr qint64 BYTES_PER_MEGABYTES = 1024 * 1024;
|
||||
static constexpr qint64 DEFAULT_MAX_SIZE = 100 * BYTES_PER_MEGABYTES;
|
||||
static constexpr qint64 BYTES_PER_GIGABYTES = 1024 * BYTES_PER_MEGABYTES;
|
||||
static constexpr qint64 DEFAULT_UNUSED_MAX_SIZE = 100 * BYTES_PER_MEGABYTES;
|
||||
static constexpr qint64 MIN_UNUSED_MAX_SIZE = 0;
|
||||
static constexpr qint64 MAX_UNUSED_MAX_SIZE = 10 * BYTES_PER_GIGABYTES;
|
||||
|
||||
/// Base class for resource caches.
|
||||
class ResourceCache : public QObject {
|
||||
|
@ -51,7 +54,7 @@ public:
|
|||
void refresh(const QUrl& url);
|
||||
|
||||
protected:
|
||||
qint64 _unusedResourcesMaxSize = DEFAULT_MAX_SIZE;
|
||||
qint64 _unusedResourcesMaxSize = DEFAULT_UNUSED_MAX_SIZE;
|
||||
qint64 _unusedResourcesSize = 0;
|
||||
QMap<int, QSharedPointer<Resource> > _unusedResources;
|
||||
|
||||
|
|
Loading…
Reference in a new issue