QAbstractNetworkCache Class Reference

[ QtNetwork module]

The QAbstractNetworkCache class provides the interface for cache implementations. 更多...

继承 QObject .

Inherited by QNetworkDiskCache .

方法


详细描述

The QAbstractNetworkCache class provides the interface for cache implementations.

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


方法文档编制

QAbstractNetworkCache.__init__ ( self , QObject   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

构造抽象网络缓存采用给定 parent .

int QAbstractNetworkCache.cacheSize ( self )

This method is abstract and should be reimplemented in any sub-class.

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

在基类中,这是纯虚函数。

另请参阅 clear ().

QAbstractNetworkCache.clear ( self )

This method is also a Qt slot with the C++ signature void clear() .

This method is abstract and should be reimplemented in any sub-class.

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

在基类中,这是纯虚函数。

另请参阅 cacheSize () 和 remove ().

QIODevice QAbstractNetworkCache.data ( self , QUrl   url )

This method is abstract and should be reimplemented in any sub-class.

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 0 is returned.

在基类中,这是纯虚函数。

另请参阅 metaData () 和 prepare ().

QAbstractNetworkCache.insert ( self , QIODevice   device )

This method is abstract and should be reimplemented in any sub-class.

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 () 和 metaData ().

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

在基类中,这是纯虚函数。

另请参阅 prepare () 和 remove ().

QNetworkCacheMetaData QAbstractNetworkCache.metaData ( self , QUrl   url )

This method is abstract and should be reimplemented in any sub-class.

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.

在基类中,这是纯虚函数。

另请参阅 updateMetaData () and data ().

QIODevice QAbstractNetworkCache.prepare ( self , QNetworkCacheMetaData   metaData )

This method is abstract and should be reimplemented in any sub-class.

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 0 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.

在基类中,这是纯虚函数。

另请参阅 remove (), updateMetaData (), and insert ().

bool QAbstractNetworkCache.remove ( self , QUrl   url )

This method is abstract and should be reimplemented in any sub-class.

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

在基类中,这是纯虚函数。

另请参阅 clear () 和 prepare ().

QAbstractNetworkCache.updateMetaData ( self , QNetworkCacheMetaData   metaData )

This method is abstract and should be reimplemented in any sub-class.

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.

在基类中,这是纯虚函数。

另请参阅 metaData () 和 prepare ().