NKCache
Simple on disk cache, backed by an NSCache in memory. It automatically purges itself when memory gets low.
Requirements
- iOS 9.0+
- Xcode 8.1
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
NKCache.swiftin 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, completionHandler: @escaping (T?)->())
func objectExistsForKey(_ key:String)->BoolContribute
We would love you for the contribution to NKCache, check the LICENSE file for more info.
Meta
Nikhil Sharma – @YourTwitter – [email protected]
Distributed under the MIT license. See LICENSE for more information.