Skip to content

philchia/lru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lru is a in memory lru cache made by go CircleCI

Go Report Card golang GoDoc license

Installation

    go get -u github.com/philchia/lru

Usage

Create a cache

import "github.com/philchia/lru"
cache := lru.New(10)

Create a thread safe cache

import "github.com/philchia/lru"
cache := lru.NewLockCache(10)

Store a k/v

cache.Set("key", "value")

Store a k/v with expired time

cache.Set("key", "value", time.Now())

Get a value with a key

if value :=cache.Get("key"); value != nil {
    print(value)
}

Delete a key

cache := lru.New(10)
cache.Del("key")

License

lru is published under the MIT license

About

lru cache made by go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages