NetworkCacheConfiguration Class

  • NetworkCacheConfiguration
  • class Esri::ArcGISRuntime::NetworkCacheConfiguration

    A singleton class to configure HTTP network caching options. More...

    Header: #include <NetworkCacheConfiguration.h>
    Since: Esri::ArcGISRuntime 100.8
    Inherits: Esri::ArcGISRuntime::Object

    This class was introduced in Esri::ArcGISRuntime 100.8.

    Public Functions

    virtual ~NetworkCacheConfiguration() override
    QString cacheDirectory() const
    Esri::ArcGISRuntime::NetworkCachePolicy cachePolicy() const
    qint64 cacheSize() const
    void clearCacheAsync()
    qint64 maximumCacheSize() const
    bool networkCachingEnabled() const
    void setCacheDirectoryAsync(const QString &directory)
    void setCachePolicyAsync(Esri::ArcGISRuntime::NetworkCachePolicy policy)
    void setMaximumCacheSizeAsync(qint64 maxSize)
    void setNetworkCachingEnabledAsync(bool enabled)

    Signals

    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.

    The Runtime 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

    [signal] void NetworkCacheConfiguration::clearCacheCompleted()

    Signal emitted when the clearCacheAsync asynchronous method completes.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [signal] void NetworkCacheConfiguration::setCacheDirectoryCompleted()

    Signal emitted when the setCacheDirectoryAsync asynchronous method completes.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [signal] void NetworkCacheConfiguration::setCachePolicyCompleted()

    Signal emitted when the setCachePolicyAsync asynchronous method completes.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [signal] void NetworkCacheConfiguration::setMaximumCacheSizeCompleted()

    Signal emitted when the setMaximumCacheSizeAsync asynchronous method completes.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [signal] void NetworkCacheConfiguration::setNetworkCachingEnabledCompleted()

    Signal emitted when the setNetworkCachingEnabledAsync asynchronous method completes.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [override virtual] 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"

    See also setCacheDirectory().

    Esri::ArcGISRuntime::NetworkCachePolicy NetworkCacheConfiguration::cachePolicy() const

    Returns the cache behavior for requests.

    The default value is NetworkCachePolicy::PreferNetwork.

    See also setCachePolicy() and NetworkCachePolicy.

    qint64 NetworkCacheConfiguration::cacheSize() const

    Returns the current size taken up by the cache.

    Returns 0 if the cache is disabled.

    void NetworkCacheConfiguration::clearCacheAsync()

    Asynchronously clears the cache directory.

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

    See also setMaximumCacheSize().

    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.

    See also setNetworkCachingEnabled().

    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.

    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.

    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.

    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.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.