https://github.com/drish/lrucache
A Java implementation of a LRU Cache.
https://github.com/drish/lrucache
Last synced: about 2 months ago
JSON representation
A Java implementation of a LRU Cache.
- Host: GitHub
- URL: https://github.com/drish/lrucache
- Owner: drish
- License: apache-2.0
- Created: 2017-05-27T21:27:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-29T01:29:23.000Z (about 9 years ago)
- Last Synced: 2025-01-16T00:50:58.015Z (over 1 year ago)
- Language: Java
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lrucache
[](https://travis-ci.org/drish/lrucache)
A Simple java implementation of a LRU Cache, it's backed by a doubly linked list and a hash map for O(1) operations.
### Usage
```java
// a cache with 5000 objects capacity;
LRUCache cache = new LRUCache(5000);
int id = 4; // some id
Guitar gibson = new Guitar();
cache.addObject(id, gibson);
cache.getMostAccessedObject(); // gibson
cache.getObject(id); // gibson
```