A singleton class to configure HTTP network caching options. More...
Header | #include <Network |
Since | Esri |
Inherits | Esri |
Public Functions
virtual | ~ |
Q | cache |
Esri | cache |
qint64 | cache |
(since Esri void | clear |
qint64 | maximum |
bool | network |
(since Esri void | set |
(since Esri void | set |
(since Esri void | set |
(since Esri void | set |
Signals
(since Esri void | clear |
(since Esri void | set |
(since Esri void | set |
(since Esri void | set |
(since Esri void | set |
Detailed Description
Network requests can be cached locally to improve performance and reduce the number of network requests. Access the singleton instance through RequestConfiguration::globalNetworkCacheConfiguration.
This API's networking code operates on its own thread, so modifying cache properties involves asynchronous calls to a different thread. Completions will be reported on signals.
Member Function Documentation
[override virtual noexcept]
NetworkCacheConfiguration::~NetworkCacheConfiguration ()
Destructor.
QString NetworkCacheConfiguration::cacheDirectory () const
Returns the directory to store the cached responses.
The default path is the value returned by QStandardPaths::CacheLocation and depends on the platform:
- MacOS - "~/Library/Caches/<APPNAME>" or "/Library/Caches/<APPNAME>".
- Windows - "C -/Users/<USER>/AppData/Local/<APPNAME>/cache".
- linux - "~/.cache/<APPNAME>"
- Android - "<APPROOT>/cache" or "<USER>/<APPNAME>/cache"
- iOS - "<APPROOT>/Library/Caches"
Esri::ArcGISRuntime::NetworkCachePolicy NetworkCacheConfiguration::cachePolicy () const
Returns the cache behavior for requests.
The default value is NetworkCachePolicy::PreferNetwork
.
See also NetworkCachePolicy.
qint64 NetworkCacheConfiguration::cacheSize () const
Returns the current size taken up by the cache.
Returns 0 if the cache is disabled.
[since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::clearCacheAsync ()
Asynchronously clears the cache directory.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::clearCacheCompleted ()
Signal emitted when the clearCacheAsync asynchronous method completes.
This function was introduced in Esri::ArcGISRuntime 100.15.
qint64 NetworkCacheConfiguration::maximumCacheSize () const
Returns the maximum size for the disk cache in bytes.
The default value is 100 MBs (100,000,000 bytes).
bool NetworkCacheConfiguration::networkCachingEnabled () const
Returns whether the network caching is enabled.
This is a global setting and applies to all network requests.
The default value is true
.
When set to false
, no disk caching will be used. When set to true
, network requests will attempt to cache results and use those as possible when the same request is made again.
Network caching can improve the performance of loading network resources.
[since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setCacheDirectoryAsync (const QString &directory)
Asynchronously sets the directory to store the cached responses from directory.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setCacheDirectoryCompleted ()
Signal emitted when the setCacheDirectoryAsync asynchronous method completes.
This function was introduced in Esri::ArcGISRuntime 100.15.
[since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setCachePolicyAsync (Esri::ArcGISRuntime::NetworkCachePolicy policy)
Asynchronously sets the cache behavior for requests to policy.
This function was introduced in Esri::ArcGISRuntime 100.15.
See also NetworkCachePolicy.
[signal, since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setCachePolicyCompleted ()
Signal emitted when the setCachePolicyAsync asynchronous method completes.
This function was introduced in Esri::ArcGISRuntime 100.15.
[since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setMaximumCacheSizeAsync (qint64 maxSize )
Asynchronously sets the maximum size for the disk cache in bytes to maxSize.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setMaximumCacheSizeCompleted ()
Signal emitted when the setMaximumCacheSizeAsync asynchronous method completes.
This function was introduced in Esri::ArcGISRuntime 100.15.
[since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setNetworkCachingEnabledAsync (bool enabled)
Asynchronously sets network caching to enabled.
This is a global setting and applies to all network requests.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void NetworkCacheConfiguration::setNetworkCachingEnabledCompleted ()
Signal emitted when the setNetworkCachingEnabledAsync asynchronous method completes.
This function was introduced in Esri::ArcGISRuntime 100.15.