Skip to content

Commit

Permalink
Use system cache location instead of profile folder for network cache
Browse files Browse the repository at this point in the history
Profile folders are often on network drives and shared among machines whereas the cache should be local (as fast as possible) and is disposable.
  • Loading branch information
m-kuhn committed Jun 4, 2019
1 parent 0deda6c commit 3957a31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/qgsnetworkaccessmanager.cpp
Expand Up @@ -34,6 +34,7 @@
#include <QNetworkReply>
#include <QThreadStorage>
#include <QAuthenticator>
#include <QStandardPaths>

#ifndef QT_NO_SSL
#include <QSslConfiguration>
Expand Down Expand Up @@ -390,8 +391,8 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache( Qt::ConnectionType conn

QString cacheDirectory = settings.value( QStringLiteral( "cache/directory" ) ).toString();
if ( cacheDirectory.isEmpty() )
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
qint64 cacheSize = settings.value( QStringLiteral( "cache/size" ), 50 * 1024 * 1024 ).toULongLong();
cacheDirectory = QStandardPaths::writableLocation( QStandardPaths::CacheLocation );
qint64 cacheSize = settings.value( QStringLiteral( "cache/size" ), 50 * 1024 * 1024 ).toLongLong();
newcache->setCacheDirectory( cacheDirectory );
newcache->setMaximumCacheSize( cacheSize );
QgsDebugMsgLevel( QStringLiteral( "cacheDirectory: %1" ).arg( newcache->cacheDirectory() ), 4 );
Expand Down

0 comments on commit 3957a31

Please sign in to comment.