https://github.com/v2e4lisp/lru-cache
simple lru-cache
https://github.com/v2e4lisp/lru-cache
Last synced: 12 months ago
JSON representation
simple lru-cache
- Host: GitHub
- URL: https://github.com/v2e4lisp/lru-cache
- Owner: v2e4lisp
- License: mit
- Created: 2014-06-22T12:28:27.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-22T13:09:05.000Z (almost 12 years ago)
- Last Synced: 2025-01-16T03:51:36.301Z (over 1 year ago)
- Language: Ruby
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# LRU::Cache
simple LRU cache
## Installation
Add this line to your application's Gemfile:
gem 'lru-cache'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lru-cache
## Usage
```ruby
require 'lru/cache'
# create a lru cache(size = 10)
lru = LRU.create 10
# set a item
lru[:k1] = :v1
lru.set :k2, :v2
# get a item
lru[:k1]
lru.get :k1
# get upper limit
lru.max
# get lru content
lru.content
```