You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After setting up the map cache, browsed areas of the map will be kept on disk. If the user browses again, that area it will use the local version.
86
+
After setting up the map cache, browsed areas of the map will be kept on disk. If the user browses again, that area it will use the local version without querying the server for that tile anymore.
87
87
88
-
Note that in the current version, the cache does not support expiration dates, so ifyou need to get an updated version ofthe tiles you must call `clear()` which will wipe out the whole cache.
88
+
This may cause the tiles to be outdated if they change inthe server. An alternative mode of working is to always query the server asking ifthere is a new tile and download it if so, or using the cached one if there were no changes. This can be done by setting the `config.loadTileMode = .serverThenCache`. See [LoadTileMode](https://www.merlos.org/MapCache/Enums/LoadTileMode.html) and [MapCacheConfig](https://www.merlos.org/MapCache/Structs/MapCacheConfig.html)
89
89
90
+
91
+
92
+
To empty the cache data:
90
93
```swift
91
94
mapCache.clear() {
92
95
// do something after clear
@@ -97,7 +100,7 @@ mapCache.clear() {
97
100
To get current cache size:
98
101
99
102
```swift
100
-
mapCache.calculateDiskSize()
103
+
mapCache.diskSize
101
104
```
102
105
103
106
You can take a look at the [**Example/ folder**](https://github.com/merlos/MapCache/tree/master/Example/MapCache) to see a complete implementation.
0 commit comments