Easy caching for codable objects.
Sebu uses JSON to store objects in the app's cache directory.
Save object
let tweets = [Tweet()] // Your own object(s)
try Sebu.default.set(tweets,
withName: "homeTimeline") // Your own cache name (overwrites by default)
Save object with expiration
try Sebu.default.set(tweets,
withName: "homeTimeline",
expiration: Calendar.current.date(byAdding: .minute, value: 5, to: Date())) // Expires in 5 minutes from now
if let cache: [Tweet] = try? Sebu.default.get(withName: "homeTimeline") {
self.tweets = cache
}
All cache
Sebu.default.clearAll()
Clear certain object
Sebu.default.clear("homeTimeline")
link |
Stars: 4 |
Last commit: 1 year ago |
Full Changelog: https://github.com/EthanLipnik/Sebu/compare/1.0.0...1.0.4
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics