Swiftpack.co -  obrhoff/SwimplyCache as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
obrhoff/SwimplyCache
LRU Cache written in Swift.
.package(url: "https://github.com/obrhoff/SwimplyCache.git", from: "1.0.3")

SwimplyCache

What is this?

SwimplyCache is a simple, threadsafe caching solution. It is internally backed by a LinkedHashMap and very fast compared to NSCache.

SwimplyCache will automatically empty itself in the event of a memory warning or a app background event.

Usage

Create the Cache

 let cache = SwimplyCache<String, String>()

Add Value

cache.setValue("Value", forKey: "Key")
cache.setValue("Value", forKey: "Key", costs: 200)

Retrieve Value

let value = cache.value(forKey: "Key")

Remove Value

Swimply allows you to remove values by following operations.

cache.remove(.key(key: "Key"))
cache.remove(.all)
cache.remove(.byLimit(countLimit: 200))
cache.remove(.byCost(costLimit: 200))

GitHub

link
Stars: 2
Last commit: 39 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API