All Projects → raulriera → Cacher

raulriera / Cacher

Licence: mit
Super simple caching solution for iOS, macOS, tvOS and watchOS.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Cacher

Django Cacheops
A slick ORM cache with automatic granular event-driven invalidation.
Stars: ✭ 1,379 (+715.98%)
Mutual labels:  caching
Sequelize Transparent Cache
Simple to use and universal cache layer for Sequelize
Stars: ✭ 137 (-18.93%)
Mutual labels:  caching
Libcache
A Lightweight in-memory key:value cache library for Go.
Stars: ✭ 152 (-10.06%)
Mutual labels:  caching
Frontend Computer Science
A list of Computer Science topics important for a Front-End Developer to learn 📝
Stars: ✭ 113 (-33.14%)
Mutual labels:  caching
Laravel Model Caching
Eloquent model-caching made easy.
Stars: ✭ 1,829 (+982.25%)
Mutual labels:  caching
Olric
Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.
Stars: ✭ 2,067 (+1123.08%)
Mutual labels:  caching
Hazelcast Python Client
Hazelcast IMDG Python Client
Stars: ✭ 92 (-45.56%)
Mutual labels:  caching
Haproxy
HAProxy Load Balancer's development branch (mirror of git.haproxy.org)
Stars: ✭ 2,463 (+1357.4%)
Mutual labels:  caching
Flutter cached network image
Download, cache and show images in a flutter app
Stars: ✭ 1,923 (+1037.87%)
Mutual labels:  caching
Mvcdonutcaching
ASP.NET MVC Extensible Donut Caching brings donut caching to ASP.NET MVC 3 and later. The code allows you to cache all of your page apart from one or more Html.Actions which can be executed every request. Perfect for user specific content.
Stars: ✭ 146 (-13.61%)
Mutual labels:  caching
Cash
HTTP response caching for Koa. Supports Redis, in-memory store, and more!
Stars: ✭ 122 (-27.81%)
Mutual labels:  caching
Data Prefetch Link
Extends next.js <Link> to allow invoking getInitialProps when prefetching a page
Stars: ✭ 128 (-24.26%)
Mutual labels:  caching
Ngx Cache
Cache utility for Angular
Stars: ✭ 144 (-14.79%)
Mutual labels:  caching
Node Cache
a node internal (in-memory) caching module
Stars: ✭ 1,660 (+882.25%)
Mutual labels:  caching
Pike
HTTP cache server, such as varnish
Stars: ✭ 155 (-8.28%)
Mutual labels:  caching
Metaphore
Cache slam defense using a semaphore to prevent dogpile effect.
Stars: ✭ 96 (-43.2%)
Mutual labels:  caching
Hazelcast Go Client
Hazelcast IMDG Go Client
Stars: ✭ 140 (-17.16%)
Mutual labels:  caching
Safer
🧿 safer writing in Python 🧿
Stars: ✭ 166 (-1.78%)
Mutual labels:  caching
Cachemanager
CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
Stars: ✭ 2,049 (+1112.43%)
Mutual labels:  caching
Nuster
A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy
Stars: ✭ 1,825 (+979.88%)
Mutual labels:  caching

Build Status

For a detail information about using "Cacher", checkout the article "Caching anything in iOS".

Installation

Manual

Drag and drop the Cacher/ folder into your project.

Carthage

Add the following to your Cartfile:

github "raulriera/Cacher"

Swift Package Manager

Add this repo to your dependencies.

How to use them

For a quick TL;DR check out the sample project at CacherDemo. It will guide you with the simplest caching possible, persisting string values.

If you like to get your hands dirty, continue reading as we are going to go into detail about how this works.

public protocol Cachable {
	var fileName: String { get }
	func transform() -> Data
}

It all comes down to this simple protocol, that has only two requirements fileName which represents the unique name to store in the filesystem, and transform which is the Data representation of what you wish to import. Using the magic of Swift 4 Codable, we can skip the transform implementation and use the implicit one declared right here.

After we implement conform to Cachable and Codable, anything can be stored in the filesystem using the persist:item:completion method.

But, let's see a more complex example

struct CachableMovies: Cachable, Codable {
	let store: String
	let movies: [Movie]

	var fileName: String {
		return "movies-\(store)"
	}

	init(store: String, movies: [Movie]) {
		self.store = store
		self.movies = movies
	}
}

struct Movie: Codable {
  enum CodingKeys : String, CodingKey {
  		case title = "movie_title"
  		case description = "movie_description"
  		case url = "movie_url"
  }

  let title: String
  let description: String
  let url: URL
}

The previous code is all we need to store a collection of movies into the filesystem. 🎉 Now we can simply use the persist method like this.

Cacher(destination: .temporary).persist(item: CachableMovies(store: "USA", movies: myArrayOfMovies)) { url, error in
	// Completion handler when the process finishes
}

Created by

Raul Riera, @raulriera

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].