class QAbstractNetworkCache

The QAbstractNetworkCache class provides the interface for cache implementations. More

Inheritance diagram of PySide6.QtNetwork.QAbstractNetworkCache

Inherited by: QNetworkDiskCache

Synopsis

Methods

Virtual methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

QAbstractNetworkCache is the base class for every standard cache that is used by QNetworkAccessManager . QAbstractNetworkCache is an abstract class and cannot be instantiated.

__init__([parent=None])
Parameters:

parentQObject

Constructs an abstract network cache with the given parent.

abstract cacheSize()
Return type:

int

Returns the current size taken up by the cache. Depending upon the cache implementation this might be disk or memory size.

In the base class this is a pure virtual function.

See also

clear()

abstract clear()

Removes all items from the cache. Unless there was failures clearing the cache cacheSize() should return 0 after a call to clear.

In the base class this is a pure virtual function.

abstract data(url)
Parameters:

urlQUrl

Return type:

QIODevice

Returns the data associated with url.

It is up to the application that requests the data to delete the QIODevice when done with it.

If there is no cache for url, the url is invalid, or if there is an internal cache error None is returned.

In the base class this is a pure virtual function.

abstract insert(device)
Parameters:

deviceQIODevice

Inserts the data in device and the prepared meta data into the cache. After this function is called the data and meta data should be retrievable using data() and metaData() .

To cancel a prepared inserted call remove() on the metadata’s url.

In the base class this is a pure virtual function.

See also

prepare() remove()

abstract metaData(url)
Parameters:

urlQUrl

Return type:

QNetworkCacheMetaData

Returns the meta data for the url url.

If the url is valid and the cache contains the data for url, a valid QNetworkCacheMetaData is returned.

In the base class this is a pure virtual function.

abstract prepare(metaData)
Parameters:

metaDataQNetworkCacheMetaData

Return type:

QIODevice

Returns the device that should be populated with the data for the cache item metaData. When all of the data has been written insert() should be called. If metaData is invalid or the url in the metadata is invalid None is returned.

The cache owns the device and will take care of deleting it when it is inserted or removed.

To cancel a prepared inserted call remove() on the metadata’s url.

In the base class this is a pure virtual function.

abstract remove(url)
Parameters:

urlQUrl

Return type:

bool

Removes the cache entry for url, returning true if success otherwise false.

In the base class this is a pure virtual function.

See also

clear() prepare()

abstract updateMetaData(metaData)
Parameters:

metaDataQNetworkCacheMetaData

Updates the cache meta date for the metaData ‘s url to metaData

If the cache does not contains a cache item for the url then no action is taken.

In the base class this is a pure virtual function.