Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qnetworkdiskcache.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNETWORKDISKCACHE_H
5#define QNETWORKDISKCACHE_H
6
7#include <QtNetwork/qtnetworkglobal.h>
8#include <QtNetwork/qabstractnetworkcache.h>
9
10QT_REQUIRE_CONFIG(networkdiskcache);
11
13
15class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache
16{
18
19public:
20 explicit QNetworkDiskCache(QObject *parent = nullptr);
22
23 QString cacheDirectory() const;
24 void setCacheDirectory(const QString &cacheDir);
25
26 qint64 maximumCacheSize() const;
27 void setMaximumCacheSize(qint64 size);
28
29 qint64 cacheSize() const override;
30 QNetworkCacheMetaData metaData(const QUrl &url) override;
31 void updateMetaData(const QNetworkCacheMetaData &metaData) override;
32 QIODevice *data(const QUrl &url) override;
33 bool remove(const QUrl &url) override;
34 QIODevice *prepare(const QNetworkCacheMetaData &metaData) override;
35 void insert(QIODevice *device) override;
36
37 QNetworkCacheMetaData fileMetaData(const QString &fileName) const;
38
39public Q_SLOTS:
40 void clear() override;
41
42protected:
43 virtual qint64 expire();
44
45private:
46 Q_DECLARE_PRIVATE(QNetworkDiskCache)
47 Q_DISABLE_COPY(QNetworkDiskCache)
48};
49
51
52#endif // QNETWORKDISKCACHE_H
IOBluetoothDevice * device
The QAbstractNetworkCache class provides the interface for cache implementations.
virtual void insert(QIODevice *device)=0
Inserts the data in device and the prepared meta data into the cache.
virtual void updateMetaData(const QNetworkCacheMetaData &metaData)=0
Updates the cache meta date for the metaData's url to metaData.
virtual QNetworkCacheMetaData metaData(const QUrl &url)=0
Returns the meta data for the url url.
virtual QIODevice * prepare(const QNetworkCacheMetaData &metaData)=0
Returns the device that should be populated with the data for the cache item metaData.
virtual qint64 cacheSize() const =0
Returns the current size taken up by the cache.
virtual void clear()=0
Removes all items from the cache.
virtual bool remove(const QUrl &url)=0
Removes the cache entry for url, returning true if success otherwise false.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QNetworkCacheMetaData class provides cache information.
The QNetworkDiskCache class provides a very basic disk cache.
\inmodule QtCore
Definition qobject.h:90
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SLOTS
long long qint64
Definition qtypes.h:55
QUrl url("example.com")
[constructor-url-reference]
diskCache setCacheDirectory(directory)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent