Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

devmaximilian/cached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cached

This library aims to be a lightweight wrapper for caching Codable types.

Installation

Swift Package Manager

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")
]

Usage

struct Article: Codable {
    let title: String
    let description: String
}

class Service {
    init() {}

    @Cached(key: "articles", defaultValue: [], ttl: .minutes(30))
    var articles: [Article]
}

License

Cached is released under the MIT license. See LICENSE for details.