Latest 2.0.0
Homepage https://github.com/MountainBuffalo/Cacher
License MIT
Platforms ios 9.0
Authors

Cacher

build-badge codecov-badge license-badge

A simple general use cache written entirely in swift. Anything can be added to the cache as long as it subscribes to the Cacheable protocol, and anything as a key as long as it subscribes to CacheableKey protocol.

Features

  • Lightweight Caching generic
  • Does One Thing & Does It Well

Usage

Create a cache

let cache = Cache<String: Data>()

Add an item to a cache

let item = Data()
cache["MyItem"] = item

Get an item from cache

let cachedItem = cache["MyItem"]

Get an item from a url

cache.load(from: someUrl, key: "MyItem") { cachedItem, wasDownload, error in

}

Built in Image Cache

Add an item to a cache

let image = UIImage()
ImageCache.shared["MyItem"] = image

Get an item from cache

let cachedImage = ImageCache.shared["MyItem"]

Setting an image on an image view

imageView.set(url: someUrl)

Precaching

Downloading images right to cache for later use

let imagePrecher = ImagePrecher()
imagePrecher.get(urls: myUrls) { items, failedUrls in
  //Do something
}

Installation

CocoaPods

pod 'Cacher'

Carthage

github "MountainBuffalo/Cacher"

Contributing

If you wish to contribute to Cacher, please submit a pull request!

License

Cacher is licensed under the MIT License. As such, Casher is free for general usage, and would make an excellent addition to your next swift application!

Latest podspec

{
    "name": "Cacher",
    "version": "2.0.0",
    "summary": "A simple no-nonsense image cache written entirely in swift.",
    "description": "A simple no-nonsense image cache written entirely in swift.",
    "homepage": "https://github.com/MountainBuffalo/Cacher",
    "license": "MIT",
    "authors": {
        "Justin Anderson": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/MountainBuffalo/Cacher.git"
    },
    "source_files": [
        "Cacher",
        "Cacher/**/*.{h,m,swift}"
    ],
    "exclude_files": "CacherTests",
    "resources": "cacher.png",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This