Lru - A simple LRU cache using go generics

Related tags

Caching lru
Overview

LRU Cache

A simple LRU cache using go generics.

Examples

Basic usage.

func main() {
    cache := lru.New[string, string]()
    cache.Set("key", "value")
    value := cache.Get("key")
    fmt.Println(value)
}

Set the capacity using the lru.WithCapacity option. The default capacity is set to 10000.

func main() {
    cache := lru.New[string, string](lru.WithCapacity(100))
    ...
}

A thread safe implementation is included for convenience.

func main() {
    cache := lru.NewSync[string, string](lru.WithCapacity(100))
    ...
}
Owner
David Boslee
Programmer
David Boslee
Cache library for golang. It supports expirable Cache, LFU, LRU and ARC.

GCache Cache library for golang. It supports expirable Cache, LFU, LRU and ARC. Features Supports expirable Cache, LFU, LRU and ARC. Goroutine safe. S

Jun Kimura 2k Jul 1, 2022
lru: the most concise and efficient LRU algorithm based on golang

lru This package of lru is the most concise and efficient LRU algorithm based on golang. Example Quick start: package main import ( "fmt" "github.

null 1 Dec 27, 2021
Least-recently-used-LRU- - Design CacheEvictionPolicy with 2 strategy LRU(Least recently used)

Least-recently-used-LRU- Design CacheEvictionPolicy with 2 strategy LRU(Least re

null 1 Jan 4, 2022
LevelDB style LRU cache for Go, support non GC object.

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa LRU Cache Install go get github.com/chai2010/c

chai2010 11 Jul 5, 2020
An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC

GCache Cache library for golang. It supports expirable Cache, LFU, LRU and ARC. Features Supports expirable Cache, LFU, LRU and ARC. Goroutine safe. S

Jun Kimura 318 May 31, 2021
LRU-based cache package for Go.

cache is LRU-based cache package written in vanilla Go - with no package dependency. LRU stands for Least Recently Used and it is one of the famous cache replacement algorithm

Gökhan Özeloğlu 25 Apr 20, 2022
Thread-safe LRU cache with permanency and context-based expiration

go-wlru Thread-safe LRU cache with permanency and context-based expiration Operational Complexity (Time) Operation Best Average Worst Access Θ(1) Θ(1)

Jason Crawford 1 Mar 7, 2022
Solution for Leetcode problem: 146. LRU Cache

Solution for Leetcode problem: 146. LRU Cache link My solution for the above lee

Dylan Smith 0 Jan 30, 2022
An in-memory key:value store/cache library written in Go 1.18 generics

go-generics-cache go-generics-cache is an in-memory key:value store/cache that is suitable for applications running on a single machine. This in-memor

Kei Kamikawa 193 Jun 30, 2022
A zero-dependency cache library for storing data in memory with generics.

Memory Cache A zero-dependency cache library for storing data in memory with generics. Requirements Golang 1.18+ Installation go get -u github.com/rod

Rodrigo Brito 11 May 26, 2022
Cache - A simple cache implementation

Cache A simple cache implementation LRU Cache An in memory cache implementation

Stanislav Petrashov 1 Jan 25, 2022
cyhone 102 Jun 22, 2022
Package cache is a middleware that provides the cache management for Flamego.

cache Package cache is a middleware that provides the cache management for Flamego. Installation The minimum requirement of Go is 1.16. go get github.

Flamego 10 Jan 16, 2022
A mem cache base on other populator cache, add following feacture

memcache a mem cache base on other populator cache, add following feacture add lazy load(using expired data, and load it asynchronous) add singlefligh

zhq 1 Oct 28, 2021
Gin-cache - Gin cache middleware with golang

Gin-cache - Gin cache middleware with golang

Anson 38 Mar 16, 2022
API Cache is a simple caching server, using grpc to accept messages.

API Cache is a simple caching server, using grpc to accept messages. It allows to store key-value pairs, where key is string and value is []byte.

null 1 Nov 16, 2021
LFU Redis implements LFU Cache algorithm using Redis as data storage

LFU Redis cache library for Golang LFU Redis implements LFU Cache algorithm using Redis as data storage LFU Redis Package gives you control over Cache

Mohamed Shapan 6 Apr 23, 2021
Cache list, count with filter param golang, using struct, hashkey

Dumbcache Cache list, count with filter param golang, using struct, hashkey Structure we hash your request object to md5 hashing and add a prefix coun

Te Nguyen 4 Nov 1, 2021
x/sync/singleflight but with Go 1.18 generics

singleflight This repo is a hard fork of golang.org/x/sync/singleflight that adds generics to the Group type so that there is no need for type asserti

Marwan Sulaiman 21 Mar 22, 2022