SwifteeCache
Simple on disk cache, backed by an NSCache in memory. It automatically purges itself when memory gets low.
NOTE: Data Model needs to implement 'Codable(Encodable&Decodable)' protocol to be saved on the cache.
Requirements
- iOS 10.0+
- Xcode 9
Installation
CocoaPods
You can use CocoaPods to install NKCache
by adding it to your Podfile
:
platform :ios, '9.0'
use_frameworks!
pod 'NKCache'
Manually
- Download and drop
SwifteeCache.swift
in your project. - Congratulations!
Usage
For adding/removing objects in cache:
func setObject<T:Codable>(_ object:T,forKey key:String)
func removeObjectForKey(_ key:String)
func removeAllObjects()
For fetching objects in cache:
func getObjectForKey<T:Codable>(_ key:String)->T?
func objectExistsForKey(_ key:String)->Bool
Contribute
We would love you for the contribution to SwifteeCache, check the LICENSE
file for more info.
Meta
Nikhil Sharma – @devilnikks – [email protected]
Distributed under the MIT license. See LICENSE
for more information.