Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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协议
- Host: GitHub
- URL: https://github.com/bbc6bae9/cachekit
- Owner: BBC6BAE9
- License: gpl-3.0
- Created: 2024-02-21T07:08:12.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-09-07T12:57:33.000Z (4 months ago)
- Last Synced: 2024-09-07T19:05:17.649Z (4 months ago)
- Topics: apple, ios, ipados, macos, swift, swiftui, visionos, watchos
- Language: Swift
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 Cachelet 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)
```