https://github.com/sephiroth74/simplelrucache
Simple LruCache
https://github.com/sephiroth74/simplelrucache
android cache kotlin library lru-cache
Last synced: 6 months ago
JSON representation
Simple LruCache
- Host: GitHub
- URL: https://github.com/sephiroth74/simplelrucache
- Owner: sephiroth74
- License: mit
- Created: 2018-08-19T03:00:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-19T14:03:33.000Z (over 7 years ago)
- Last Synced: 2025-03-22T19:32:17.000Z (10 months ago)
- Topics: android, cache, kotlin, library, lru-cache
- Language: Kotlin
- Size: 68.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleLruCache
Simple LruCache for Android
[](https://travis-ci.org/sephiroth74/SimpleLruCache)
[](https://search.maven.org/search?q=g:it.sephiroth.android.library.cache%20a:simple-lru-cache)
# Installation
Add the library dependency:
implementation 'it.sephiroth.android.library.cache:simple-lru-cache:**version**'
# Usage
```
// creates a new string lru-cache of 3 elements max
val cache = LruCache(3)
cache[0] = "first"
cache[1] = "second"
cache[2] = "third"
cache[3] = "fourth" // key `0` is removed
val entry = cache[1] // returns `second`
val entry2 = cache[0] // returns null
cache.erase(1) // key `1` is removed (now size is 2)
```