;

NetworkCacheConfiguration Class

  • NetworkCacheConfiguration
  • class Esri::ArcGISRuntime::NetworkCacheConfiguration

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

    Header: #include <NetworkCacheConfiguration>
    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 clearCache()
    qint64 maximumCacheSize() const
    bool networkCachingEnabled() const
    void setCacheDirectory(const QString &directory)
    void setCachePolicy(Esri::ArcGISRuntime::NetworkCachePolicy policy)
    void setMaximumCacheSize(qint64 maxSize)
    void setNetworkCachingEnabled(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.

    Member Function Documentation

    [signal] void NetworkCacheConfiguration::networkCachingEnabledChanged()

    Signal emitted when the networkCachingEnabled property changes.

    [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::clearCache()

    Clears the cache directory.

    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::setCacheDirectory(const QString &directory)

    Sets the directory to store the cached responses from directory.

    See also cacheDirectory().

    void NetworkCacheConfiguration::setCachePolicy(Esri::ArcGISRuntime::NetworkCachePolicy policy)

    Sets the cache behavior for requests to policy.

    See also cachePolicy() and NetworkCachePolicy.

    void NetworkCacheConfiguration::setMaximumCacheSize(qint64 maxSize)

    Sets the maximum size for the disk cache in bytes to maxSize.

    See also maximumCacheSize().

    void NetworkCacheConfiguration::setNetworkCachingEnabled(bool enabled)

    Sets network caching to enabled.

    This is a global setting and applies to all network requests.

    See also networkCachingEnabled().

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