diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2021-03-06 20:26:21 +0100 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2021-03-06 20:29:50 +0100 |
| commit | 0396fdb01d12e51bd2cc63478819b366c0453d29 (patch) | |
| tree | 082fcd53b7b61c0dc2a0dc6b676729e155c07fd2 /src/cachehandler.cpp | |
| parent | 21c821c49ef82d1e84b0b9c8c3d357dc559479d4 (diff) | |
Moves all globals into a structure that can be deleted before the app exists. Fixes #193.
Diffstat (limited to 'src/cachehandler.cpp')
| -rw-r--r-- | src/cachehandler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cachehandler.cpp b/src/cachehandler.cpp index d9c8836..35447f9 100644 --- a/src/cachehandler.cpp +++ b/src/cachehandler.cpp @@ -8,14 +8,14 @@ void CacheHandler::push(const QUrl &url, const QByteArray &body, const MimeType { // Skip if this item is above the cached item size threshold int bodysize = body.size(); - if (bodysize > (kristall::options.cache_threshold * 1024)) + if (bodysize > (kristall::globals().options.cache_threshold * 1024)) { qDebug() << "cache: item exceeds threshold (" << IoUtil::size_human(body.size()) << ")"; return; } // Pop cached items until we are below the cache limit - while ((bodysize + this->size()) > (kristall::options.cache_limit * 1024)) + while ((bodysize + this->size()) > (kristall::globals().options.cache_limit * 1024)) { this->popOldest(); } @@ -78,7 +78,7 @@ int CacheHandler::size() void CacheHandler::clean() { // Don't clean anything if we have unlimited item life. - if (kristall::options.cache_unlimited_life) return; + if (kristall::globals().options.cache_unlimited_life) return; // Find list of keys to delete std::vector<QString> vec; @@ -86,7 +86,7 @@ void CacheHandler::clean() { // Check if this cache item is expired. if (QDateTime::currentDateTime() > i.second->time_cached - .addSecs(kristall::options.cache_life * 60)) + .addSecs(kristall::globals().options.cache_life * 60)) { vec.emplace_back(std::move(i.first)); } |
