LRU Cache Package

Your go-to solution for efficient caching in Dart

Features

Efficient Caching

Store and retrieve data quickly with our optimized LRU caching mechanism.

Simple API

Easy-to-use API that integrates seamlessly into your Dart applications.

Automatic Eviction

Automatically evicts the least recently used items to manage memory effectively.

Usage

Getting Started

To use the LRU Cache package, add it to your pubspec.yaml file:

dependencies:  simple_lru_cache: ^0.2.0

Example Code

Here’s a simple example of how to use the LRU Cache:

            
                import 'package:simple_lru_cache/simple_lru_cache.dart';
                
                void main() {
                    final cache = LRUCache(2);
                    cache.put(1, 'one');
                    cache.put(2, 'two');
                    print(cache.get(1)); // Outputs: one
                    cache.put(3, 'three'); // Evicts key 2
                    print(cache.get(2)); // Exception thrown
                }