https://github.com/healeycodes/oak-lru-cache
🌳 An LRU cache written in Oak.
https://github.com/healeycodes/oak-lru-cache
lru-cache oaklang
Last synced: about 2 months ago
JSON representation
🌳 An LRU cache written in Oak.
- Host: GitHub
- URL: https://github.com/healeycodes/oak-lru-cache
- Owner: healeycodes
- License: mit
- Created: 2022-02-14T21:23:45.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-14T23:05:20.000Z (about 4 years ago)
- Last Synced: 2025-09-12T05:53:24.163Z (7 months ago)
- Topics: lru-cache, oaklang
- Homepage:
- Size: 6.84 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# oak-lru-cache
[](https://github.com/healeycodes/oak-lru-cache/actions/workflows/test.yml)
A least recently used (LRU) cache written in [Oak](https://oaklang.org/).
Usage:
```
{
lru: lru
} := import('lru')
cache := lru(5) // Max keys
cache.set('foo', 'bar')
cache.get('foo')
```
Benchmarks (run in CI):
```text
Inserted 1 key in: 0.018358230590820312 ms
Inserted 100 keys in: 1.4066696166992188 ms
Inserted 10000 keys in: 119.19784545898438 ms
Each lru.set() call took 0.013117778301239013 ms (avg) over 100000 entries
```
## Tests
```bash
vendor/oak-linux-v0.1 lru.test.oak
```
## Benchmarks
```bash
vendor/oak-linux-v0.1 lru.bench.oak
```