๐Ÿ’พ Simple memory & disk cache

Overview

Cache

๐Ÿ’พ Simple memory & disk cache

Usage

๐Ÿง‘โ€๐Ÿ’ป Default

let cache = Cache<String>()

try memory.save("MyValue", forKey: "MyKey")

let cached = try cache.value(forKey: "MyKey")

๐Ÿš€ Advanced

You can also use custom object with Codable

struct CustomObject: Codable {
    let value: Int
}

let memory = MemoryCache<CustomObject>(countLimit: 100)
let disk = DiskCache<CustomObject>(fileManager: fileManager)
let cache = Cache<CustomObject>(memory: memory, disk: disk)

try cache.save(CustomObject(value: 0), forKey: "MyKey")

let cached = try cache.value(forKey: "MyKey")

โ™ป๏ธ Flow

Load value

  1. Load memory cache if available
  2. Load disk cache if available 2-1. then, save to memory cache if value existed in disk cache

Save value

  1. Save memory & cache

๐Ÿงฐ Installation

  1. In your Xcode project, navigate to File > Swift Packages > Add Package Dependancy...
  2. Paste the following into the URL field: https://github.com/cozzin/Cache
You might also like...
High performance cache framework for iOS.
High performance cache framework for iOS.

YYCache High performance cache framework for iOS. (It's a component of YYKit) Performance You may download and compile the latest version of sqlite an

Everyone tries to implement a cache at some point in their iOS appโ€™s lifecycle, and this is ours.
Everyone tries to implement a cache at some point in their iOS appโ€™s lifecycle, and this is ours.

Everyone tries to implement a cache at some point in their appโ€™s lifecycle, and this is ours. This is a library that allows people to cache NSData wit

Track is a thread safe cache write by Swift. Composed of DiskCache and MemoryCache which support LRU.
Track is a thread safe cache write by Swift. Composed of DiskCache and MemoryCache which support LRU.

Track is a thread safe cache write by Swift. Composed of DiskCache and MemoryCache which support LRU. Features Thread safe: Implement by dispatch_sema

UITableView cell cache that cures scroll-lags on cell instantiating

UITableView + Cache https://github.com/Kilograpp/UITableView-Cache UITableView cell cache that cures scroll-lags on a cell instantiating. Introduction

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X

PINCache Fast, non-deadlocking parallel object cache for iOS and OS X. PINCache is a fork of TMCache re-architected to fix issues with deadlocking cau

Cache library for videos for React Native

@lowkey/react-native-cache Cache everything Installation npm install @lowkey/react-native-cache Usage import ReactNativeCache from "@lowkey/react-nati

CachedAsyncImage is the simplest way to add cache to your AsyncImage.

CachedAsyncImage ๐Ÿ—ƒ๏ธ CachedAsyncImage is AsyncImage, but with cache capabilities. Usage CachedAsyncImage has the exact same API and behavior as AsyncI

๐Ÿˆ Cache CocoaPods for faster rebuild and indexing Xcode project.
๐Ÿˆ Cache CocoaPods for faster rebuild and indexing Xcode project.

Motivation Working on a project with a huge amount of pods I had some troubles: - Slow and unnecessary indexing of pods targets, which implementation

XCRemoteCache is a remote cache tool for Xcode projects.
XCRemoteCache is a remote cache tool for Xcode projects.

XCRemoteCache is a remote cache tool for Xcode projects. It reuses target artifacts generated on a remote machine, served from a simple REST server. H

Releases(1.0.0)
Owner
SeongHo Hong
๏ฃฟ iOS Developer
SeongHo Hong
MemoryCache - type-safe, thread-safe memory cache class in Swift

MemoryCache is a memory cache class in swift. The MemoryCache class incorporates LRU policies, which ensure that a cache doesnโ€™t

Yusuke Morishita 74 Nov 24, 2022
Cache - Nothing but Cache.

Cache doesn't claim to be unique in this area, but it's not another monster library that gives you a god's power. It does nothing but caching, but it does it well. It offers a good public API with out-of-box implementations and great customization possibilities. Cache utilizes Codable in Swift 4 to perform serialization.

HyperRedink 2.7k Dec 28, 2022
Apple Asset Cache (Content Cache) Tools

AssetCacheTool A library and tool for interacting with both the local and remote asset caches. This is based on research I did a few years ago on the

Kenneth Endfinger 21 Jan 5, 2023
Carlos - A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps.

Carlos A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps. Breaking Changes Carlos 1.0.0 has been migrated from PiedPiper de

National Media & Tech 628 Dec 3, 2022
A simple cache that can hold anything, including Swift items

CacheIsKing CacheIsKing is a simple cache that allows you to store any item, including objects, pure Swift structs, enums (with associated values), et

Christopher Luu 13 Jan 22, 2018
A simple but flexible cache

Carlos A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps. Breaking Changes Carlos 1.0.0 has been migrated from PiedPiper de

National Media & Tech 628 Dec 3, 2022
MrCode is a simple GitHub iPhone App that can cache Markdown content (include images in HTML) for read it later.

MrCode is a simple GitHub iPhone App that can cache Markdown content (include images in HTML) for read it later.

hao 448 Dec 19, 2022
CachyKit - A Caching Library is written in Swift that can cache JSON, Image, Zip or AnyObject with expiry date/TTYL and force refresh.

Nice threadsafe expirable cache management that can cache any object. Supports fetching from server, single object expire date, UIImageView loading etc.

Sadman Samee 122 Dec 28, 2022
Cachyr A typesafe key-value data cache for iOS, macOS, tvOS and watchOS written in Swift.

Cachyr A typesafe key-value data cache for iOS, macOS, tvOS and watchOS written in Swift. There already exists plenty of cache solutions, so why creat

Norsk rikskringkasting (NRK) 124 Nov 24, 2022
A lightweight generic cache for iOS written in Swift with extra love for images.

Haneke is a lightweight generic cache for iOS and tvOS written in Swift 4. It's designed to be super-simple to use. Here's how you would initalize a J

Haneke 5.2k Dec 29, 2022