Skip to content

mackoj/CacheManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cache Manager

import Lottie

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)