NMCache 0.7

NMCache 0.7

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Francesco Colleoni - nearit.com, Alex Corlatti, Vincenzo.



 
Depends on:
SwiftyJSON~> 2.3
YapDatabase~> 2.9
 

  • By
  • Francesco Colleoni, Vincenzo Ferrara and Alex Corlatti

NMCache

A wrapper for YapDatabase which can be used as a simple cache

This library is a wrapper for YapDatabase and exposed methods can be used to:

  • fetch one or more resources from a local database within a collection
  • persist resources into collections of a local database
  • remove a single or all resources from the local database

All resources must implement protocol CacheResourceSerializable:

  • all CacheResourceSerializable must expose an id: String property (get)
  • all CacheResourceSerializable must expose a dictionary: [String: AnyObject] property (get)
  • it is mandatory that resources conforming to CacheResourceSerializable protocol could be initialized with a [String: AnyObject] dictionary - the initializer is failable

CacheResourceSerializable protocol uses NMJSON module. All “search-by-path queries” executed on json property of classes implementing CacheResourceSerializable will use “.” (dot) as queries’ path separator, unless other separators are specified: for example, a string value inside of a CacheResourceSerializable compliant class could be found by calling <object>.json.string("<your.string.path>").

As of version 0.3.0, NMCache does not support queries.