Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bbc6bae9/cachekit

Swift磁盘缓存,一般用于缓存网络请求,缓存数据需要遵守codable协议
https://github.com/bbc6bae9/cachekit

apple ios ipados macos swift swiftui visionos watchos

Last synced: about 2 months ago
JSON representation

Swift磁盘缓存,一般用于缓存网络请求,缓存数据需要遵守codable协议

Awesome Lists containing this project

README

        

# Cache

Cache is a lightweight disk caching tool commonly used to store data returned from network requests.

# Quick Start

1、Init cache

```Swift
import Cache

let cache = DiskCache<[xxx]>(filename:"iptv_channels", expirationInterval: 30 * 24 * 60 * 60)
```

2、Write cache to disk

```swift
cache.setValue(channels, forKey: keyString)
try? await cache.saveToDisk()

```

3、Load cache from disk

```Swift
cache.loadFromDisk()
```

4、Remove cache from disk

```swift
cache.removeValue(forKey: keyString)
```