This library aims to be a lightweight wrapper for caching Codable
types.
Add Cached as a dependency by including it under dependencies
in the package manifest file, Package.swift
.
dependencies: [
.package(url: "https://github.com/devmaximilian/cached.git", from: "x.x.x")
]
struct Article: Codable {
let title: String
let description: String
}
class Service {
init() {}
@Cached(key: "articles", defaultValue: [], ttl: .minutes(30))
var articles: [Article]
}
Cached is released under the MIT license. See LICENSE for details.