NMLRUCache 0.1.2

NMLRUCache 0.1.2

TestsTested
LangLanguage
License MIT
ReleasedLast Release Mar 2022

Maintained by Nicholas Maccharoli.



  • By
  • Nicholas Maccharoli

In Memory LRU Cache Implementation for iOS and OS X.

Requirements

  • iOS 5.0+
  • ARC

Features

  • Threadsafe and optimized for use with Grand Central Dispatch.
  • Completely In Memory Cache that deletes least recently used elements.

Installation

Using CocoaPods

  • If you are using CocoaPods Add pod 'NMLRUCache' to the Podfile in your project's root and run pod install

Copy & Paste Method

  • Copy the folder NMLRUCache/ containing the files NMLRUCache.h/m and NMLRUImageCache.h/m into your project.

Usage

Initialization:

Creating an LRU Image Cache singleton:

    NMLRUCache *imageCache = [NMLRUCache sharedCache];

Changing Shared Cache Size i.e to 20 elements

   [NMLRUCache sharedCache].threshHold = 20;

Storing an image in the Cache:

    [imageCache setImage:image forKey:@"imageKey"];

Fetching Image from Cache

    [imageCache imageForKey:@"imageKey"];