Swiftpack.co - Package - mackoj/swift-cache-manager

Cache Manager

struct User : Codable, Equatable {
  let id : Int
  let name : String
}

class LocalAnimationCache: AnimationCacheProvider {

  let cache = CacheManager<Animation>()

  public init() { }

  public func animation(forKey: String) -> Animation? {
    return cache?.load(forKey.sha1!)
  }

  public func setAnimation(_ animation: Animation, forKey: String) {
    cache?.save(animation, forKey.sha1!)
  }

  public func clearCache() {
    cache?.removeAllFileFromCache()
  }
}
  

Done

  • ☑ Add test
  • ☑ Open Source
  • ☑ Add a loadAll

ToDo

  • ☐ Better documentation
  • ☐ Better errors
  • ☐ Add CI
  • ☐ Add support for Property Wrappers - https://github.com/mackoj/Burritos
  • ☐ Improve Package.swift
  • ☐ Support various storage type (today only JSON)

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

- 2019-10-08 20:22:31

- 2019-09-25 20:40:38

- 2019-09-25 20:40:12