|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.network.QAbstractNetworkCache
com.trolltech.qt.network.QNetworkDiskCache
public class QNetworkDiskCache
The QNetworkDiskCache class provides a very basic disk cache. QNetworkDiskCache stores each url in its own file inside of the cacheDirectory using QDataStream
. Files with a text MimeType are compressed using qCompress. Each cache file starts with "cache_" and ends in ".cache". Data is written to disk only in insert()
and updateMetaData()
.
Currently you can not share the same cache files with more then one disk cache.
QNetworkDiskCache by default limits the amount of space that the cache will use on the system to 50MB.
Note you have to set the cache directory before it will work.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QNetworkDiskCache()
Creates a new disk cache. |
|
QNetworkDiskCache(QObject parent)
Creates a new disk cache. |
Method Summary | |
---|---|
java.lang.String |
cacheDirectory()
Returns the location where cached files will be stored. |
protected long |
expire()
Cleans the cache so that its size is under the maximum cache size. |
QNetworkCacheMetaData |
fileMetaData(java.lang.String fileName)
Returns the QNetworkCacheMetaData for the cache file fileName. |
long |
maximumCacheSize()
Returns the current maximum size for the disk cache. |
void |
setCacheDirectory(java.lang.String cacheDir)
Sets the directory where cached files will be stored to cacheDir |
void |
setMaximumCacheSize(long size)
Sets the maximum size of the disk cache to be size. |
Methods inherited from class com.trolltech.qt.network.QAbstractNetworkCache |
---|
cacheSize, clear, data, insert, metaData, prepare, remove, updateMetaData |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QNetworkDiskCache()
QAbstractNetworkCache
's constructor.
public QNetworkDiskCache(QObject parent)
QAbstractNetworkCache
's constructor.
Method Detail |
---|
public final java.lang.String cacheDirectory()
setCacheDirectory()
.
public final QNetworkCacheMetaData fileMetaData(java.lang.String fileName)
QNetworkCacheMetaData
for the cache file fileName. If fileName is not a cache file QNetworkCacheMetaData
will be invalid.
public final long maximumCacheSize()
setMaximumCacheSize()
.
public final void setCacheDirectory(java.lang.String cacheDir)
QNetworkDiskCache will create this directory if it does not exists.
Prepared cache items will be stored in the new cache directory when they are inserted.
cacheDirectory()
, and QDesktopServices::CacheLocation
.
public final void setMaximumCacheSize(long size)
If the new size is smaller then the current cache size then the cache will call expire()
.
maximumCacheSize()
.
protected long expire()
When the current size of the cache is greater then the maximumCacheSize()
older cache files are removed until the total size is less then 90% of maximumCacheSize()
starting with the oldest ones first using the file creation date to determine how old a cache file is.
Subclasses can reimplement this function to change the order that cache files are removed taking into account information in the application knows about that QNetworkDiskCache does not, for example the number of times a cache is accessed.
Note: cacheSize()
calls expire if the current cache size is unknown.
maximumCacheSize()
, and fileMetaData()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |