gocache

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2022 License: MPL-2.0

README

GoCache

This library provides a Cache interface which can be implemented to provide Caches based on various kind of eviction policies

The lru package implements a fixed capacity and thread safe Cache which uses LRU (Least Recently Used) as an eviction policy

Currently, key and value type is string which can be changed to use interface{} to support ANY kind for key and value

Example


import cache "github.com/chiragtayal/gocache/cache"

cfg := cache.Config{Policy: cache.LRU, Size: 10}
c := cache.NewCache(cfg)

c.Put("a", "1")
value, err := c.Get("a")

Directories

Path Synopsis
Package cache is a generated GoMock package.
Package cache is a generated GoMock package.
lru

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL