Skip to content

A wrapper singleton class, easy to store, get and delete (single and all) items store in Cache

License

Notifications You must be signed in to change notification settings

aleemrazzaq/NSCacheSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NSCacheSwift

NSCache holds the item in memory and is used for optimal performance. But it takes up memory (RAM) and you really should make sure that if you use NSCache that you respond to memory warnings and purge the NSCache in those cases. And when the app terminates, the NSCache is lost. https://developer.apple.com/documentation/foundation/nscache

Cache Class:

ARCache.swift is wrapper singleton class has found methods

func setObjectInCache(object:AnyObject, key:AnyObject) //Store object in cache
func getObjectFromCache(key:AnyObject) -> AnyObject // Get Object from Cache
func removeSingleObject(key:AnyObject) // Remove any single object
func destroyCache() // Flush all caches

Usage:

ARCache.sharedInstance.setObjectInCache(object: image, key: "key" as AnyObject) // to store
ARCache.sharedInstance.getObjectFromCache(key: "key" as AnyObject) // to fetch from cache

About

A wrapper singleton class, easy to store, get and delete (single and all) items store in Cache

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages