QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
QgsNetworkDiskCache Class Reference

Wrapper implementation of QNetworkDiskCache with all methods guarded by a mutex solely for internal use of QgsNetworkAccessManagers. More...

#include <qgsnetworkdiskcache.h>

Inheritance diagram for QgsNetworkDiskCache:

Public Slots

void clear () override

Public Member Functions

QString cacheDirectory () const
qint64 cacheSize () const override
QIODevice * data (const QUrl &url) override
QNetworkCacheMetaData fileMetaData (const QString &fileName) const
bool hasInvalidMatchForRequest (const QNetworkRequest &request)
 Returns true if the cache has a matching but invalid entry for a request.
bool hasPendingRequestForUrl (const QUrl &url) const
 Returns true if there is a pending (ongoing) request in place for the specified url.
void insert (QIODevice *device) override
void insertPendingRequestHeaders (const QUrl &url, const QVariantMap &headers)
 Registers the original request headers for a pending request to the specified url.
qint64 maximumCacheSize () const
QNetworkCacheMetaData metaData (const QUrl &url) override
QIODevice * prepare (const QNetworkCacheMetaData &metaData) override
bool remove (const QUrl &url) override
void removePendingRequestForUrl (const QUrl &url) const
 Removes a pending (ongoing) request in place for the specified url.
void setCacheDirectory (const QString &cacheDir)
void setMaximumCacheSize (qint64 size)
void updateMetaData (const QNetworkCacheMetaData &metaData) override

Static Public Member Functions

static qint64 smartCacheSize (const QString &path)
 Returns a smart cache size, in bytes, based on available free space.

Protected Member Functions

qint64 expire () override

Friends

class QgsNetworkAccessManager

Detailed Description

Wrapper implementation of QNetworkDiskCache with all methods guarded by a mutex solely for internal use of QgsNetworkAccessManagers.

Note
not available in Python bindings

Definition at line 53 of file qgsnetworkdiskcache.h.

Member Function Documentation

◆ cacheDirectory()

QString QgsNetworkDiskCache::cacheDirectory ( ) const
See also
QNetworkDiskCache::cacheDirectory

Definition at line 100 of file qgsnetworkdiskcache.cpp.

◆ cacheSize()

qint64 QgsNetworkDiskCache::cacheSize ( ) const
override
See also
QNetworkDiskCache::cacheSize()

Definition at line 131 of file qgsnetworkdiskcache.cpp.

◆ clear

void QgsNetworkDiskCache::clear ( )
overrideslot
See also
QNetworkDiskCache::clear()

Definition at line 204 of file qgsnetworkdiskcache.cpp.

◆ data()

QIODevice * QgsNetworkDiskCache::data ( const QUrl & url)
override
See also
QNetworkDiskCache::data()

Definition at line 149 of file qgsnetworkdiskcache.cpp.

◆ expire()

qint64 QgsNetworkDiskCache::expire ( )
overrideprotected
See also
QNetworkDiskCache::expire()

Definition at line 198 of file qgsnetworkdiskcache.cpp.

◆ fileMetaData()

QNetworkCacheMetaData QgsNetworkDiskCache::fileMetaData ( const QString & fileName) const
See also
QNetworkDiskCache::fileMetaData()

Definition at line 192 of file qgsnetworkdiskcache.cpp.

◆ hasInvalidMatchForRequest()

bool QgsNetworkDiskCache::hasInvalidMatchForRequest ( const QNetworkRequest & request)

Returns true if the cache has a matching but invalid entry for a request.

Since QNetworkDiskCache entirely basis cache storage on URLs alone, we may get situations where there's a match for a URL in the cache but it should NOT be used for the specified request (e.g. when the previous response had a non-matching "Vary" attribute).

If this method returns false, then the request should be amended to prevent potential false-positive retrieval from cache.

This method is thread-safe.

Definition at line 58 of file qgsnetworkdiskcache.cpp.

◆ hasPendingRequestForUrl()

bool QgsNetworkDiskCache::hasPendingRequestForUrl ( const QUrl & url) const

Returns true if there is a pending (ongoing) request in place for the specified url.

This method is thread-safe.

See also
insertPendingRequestHeaders()
removePendingRequestForUrl()
Since
QGIS 4.0

Definition at line 46 of file qgsnetworkdiskcache.cpp.

◆ insert()

void QgsNetworkDiskCache::insert ( QIODevice * device)
override
See also
QNetworkDiskCache::insert()

Definition at line 186 of file qgsnetworkdiskcache.cpp.

◆ insertPendingRequestHeaders()

void QgsNetworkDiskCache::insertPendingRequestHeaders ( const QUrl & url,
const QVariantMap & headers )

Registers the original request headers for a pending request to the specified url.

This method is thread-safe.

See also
hasPendingRequestForUrl()
removePendingRequestForUrl()
Since
QGIS 4.0

Definition at line 40 of file qgsnetworkdiskcache.cpp.

◆ maximumCacheSize()

qint64 QgsNetworkDiskCache::maximumCacheSize ( ) const
See also
QNetworkDiskCache::maximumCacheSize()

Definition at line 112 of file qgsnetworkdiskcache.cpp.

◆ metaData()

QNetworkCacheMetaData QgsNetworkDiskCache::metaData ( const QUrl & url)
override
See also
QNetworkDiskCache::metaData()

Definition at line 137 of file qgsnetworkdiskcache.cpp.

◆ prepare()

QIODevice * QgsNetworkDiskCache::prepare ( const QNetworkCacheMetaData & metaData)
override
See also
QNetworkDiskCache::prepare()

Definition at line 161 of file qgsnetworkdiskcache.cpp.

◆ remove()

bool QgsNetworkDiskCache::remove ( const QUrl & url)
override
See also
QNetworkDiskCache::remove()

Definition at line 155 of file qgsnetworkdiskcache.cpp.

◆ removePendingRequestForUrl()

void QgsNetworkDiskCache::removePendingRequestForUrl ( const QUrl & url) const

Removes a pending (ongoing) request in place for the specified url.

This method is thread-safe.

See also
insertPendingRequestHeaders()
hasPendingRequestForUrl()
Since
QGIS 4.0

Definition at line 52 of file qgsnetworkdiskcache.cpp.

◆ setCacheDirectory()

void QgsNetworkDiskCache::setCacheDirectory ( const QString & cacheDir)
See also
QNetworkDiskCache::setCacheDirectory

Definition at line 106 of file qgsnetworkdiskcache.cpp.

◆ setMaximumCacheSize()

void QgsNetworkDiskCache::setMaximumCacheSize ( qint64 size)
See also
QNetworkDiskCache::setMaximumCacheSize()

Definition at line 118 of file qgsnetworkdiskcache.cpp.

◆ smartCacheSize()

qint64 QgsNetworkDiskCache::smartCacheSize ( const QString & path)
static

Returns a smart cache size, in bytes, based on available free space.

Since
QGIS 3.40

Definition at line 275 of file qgsnetworkdiskcache.cpp.

◆ updateMetaData()

void QgsNetworkDiskCache::updateMetaData ( const QNetworkCacheMetaData & metaData)
override
See also
QNetworkDiskCache::updateMetaData()

Definition at line 143 of file qgsnetworkdiskcache.cpp.

◆ QgsNetworkAccessManager

friend class QgsNetworkAccessManager
friend

Definition at line 166 of file qgsnetworkdiskcache.h.


The documentation for this class was generated from the following files: