CacheConfiguration
public struct CacheConfiguration
extension CacheConfiguration: Equatable
Cache configuration for caching both tiles and styles.
It provides control over the system memory and disk capacity used for caching, as well as the maximum cache duration for style resources
and a mapping of cache durations to corresponding request URL filters.
Unlike style caching, the tiles’ cache duration is handled by the server, utilizing the max-age header.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Creates an instance of
CacheConfiguration.If no parameters are provided, the
CacheConfigurationwill be initialized with the following default values:memoryCapacity: 5MBdiskCapacity: 50MBduration: 24 hourscacheDurationFilter: [:]Declaration
Swift
public init( memoryCapacity: Measurement<UnitInformationStorage> = .init(value: 5, unit: .megabytes), diskCapacity: Measurement<UnitInformationStorage> = .init(value: 50, unit: .megabytes), duration: Measurement<UnitDuration> = .init(value: 24, unit: .hours), cacheDurationFilter: [String: Measurement<UnitDuration>] = [:] )Parameters
memoryCapacityThe caching capacity, in bytes, while caching the tiles to system memory.
diskCapacityThe caching capacity, in bytes, while caching the tiles and styles to disk.
durationThe maxium amount of time that a style fetched resource should be allowed to remain in cache.
cacheDurationFilterMapping of the data duration in cache to the corresponding request URL filter. For example: Request:
https://api.tomtom.com/map/2/tile/basic/{z}/{x}/{y}.pbfResponse:CacheControl = "maxAge=60"cacheDurationFilter =["/tile/basic": .init(value: 120, unit: .seconds)]In this case, Response data will be stored in cache for 120 seconds instead of 60.
-
The caching capacity, in bytes, while caching the tiles to system memory.
Declaration
Swift
public let memoryCapacity: Measurement<UnitInformationStorage> -
The caching capacity, in bytes, while caching the tiles and styles to disk.
Declaration
Swift
public let diskCapacity: Measurement<UnitInformationStorage> -
The maximum amount of time that a style fetched resource should be allowed to remain in cache.
Declaration
Swift
public let duration: Measurement<UnitDuration> -
Mapping of the data duration in cache to the corresponding request URL filter.
For example: Request:
https://api.tomtom.com/map/2/tile/basic/{z}/{x}/{y}.pbfResponse:CacheControl = "maxAge=60"cacheDurationFilter =["/tile/basic": .init(value: 120, unit: .seconds)]In this case, Response data will be stored in cache for 120 seconds instead of 60.Declaration
Swift
public let cacheDurationFilter: [String : Measurement<UnitDuration>]
TomTom SDK for iOS (0.53.1)
CacheConfiguration