Skip to content

nvkiet/FTWCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FTWCache

Swift 2.1 Platforms iOS License MIT

FTWCache is a small utility library to support caching data locally so we can pull them when we need them. The original repo is written in objective-c by @khanlou. So I want to port the code to swift 2 and support to install the library via CocoaPods.

Usage

FTWCache has two class methods for setting and retrieving data:

class func setObject(data: NSData, forKey key:String)

and

class func objectForKey(key: String) -> NSData?

and you can reset the cache with

class func resetCache()

It stores the files in your Caches folder in its own folder. The default expiration time is 7 days, but you can modify that if you need.

It takes NSData objects, so anything you can format in that way (audio files, images, simple text) can be store in the cache. Note also that the system will also periodically flush the Caches folders of apps if it finds it needs more space.

Installation

FTWCache is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FTWCache"

Author

Kiet Nguyen - iOS blogger at http://vankiet.com/

License

FTWCache is released under the MIT license. See LICENSE.md