💾 Simple memory & disk cache
let cache = Cache<String>()
try memory.save("MyValue", forKey: "MyKey")
let cached = try cache.value(forKey: "MyKey")
You can also use custom object with Codable
struct CustomObject: Codable {
let value: Int
}
let memory = MemoryCache<CustomObject>(countLimit: 100)
let disk = DiskCache<CustomObject>(fileManager: fileManager)
let cache = Cache<CustomObject>(memory: memory, disk: disk)
try cache.save(CustomObject(value: 0), forKey: "MyKey")
let cached = try cache.value(forKey: "MyKey")
link |
Stars: 4 |
Last commit: 1 year ago |
Full Changelog: https://github.com/cozzin/Cache/compare/1.0.0...1.0.1
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics