Skip to content

A fast, lightweight LRU cache implementation in Java.

License

Notifications You must be signed in to change notification settings

0xShamil/lru-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LRU Cache

license Build Status

A non-blocking cache where entries are indexed by a key.

The implementation is mostly taken from the Undertow project and modified for standalone usage. The original source code, being an internal implementation, is not very user-friendly. This implementation tries to provide fluent APIs on top of that. It is not to be considered a fork, since I still regularly synchronize changes from the upstream project.

Installation

Gradle

dependencies {
    implementation 'dev.shamil:lru-cache:1.0.0'
}

Maven

<dependency>
  <groupId>dev.shamil</groupId>
  <artifactId>lru-cache</artifactId>
  <version>1.0.0</version>
</dependency>

Usage

Create LRUCache<K, V> instance.

final LRUCache<String, String> cache = new LRUCache.Builder<String, String>()
        .initialCapacity(64) // defaults to 16
        .maximumSize(8096) // required
        .expiresAfterWrite(Duration.ofSeconds(180)) // defaults to -1, never expires
        .build();

Licenses

The original code is licensed under the Apache 2.0. All modifications to the source code is licensed under the MIT License.

About

A fast, lightweight LRU cache implementation in Java.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages