Awesome Go

cache

CategoryDatabase
SubcategoryData stores with expiring records, in-memory distributed data stores, or in-memory subsets of file-based databases.
Stars184

In-memory key:value store with expiration time, 0 dependencies, <100 LoC, 100% coverage.

About cache

cache

Godoc Report Tests Coverage Sponsor

Cache arbitrary data with an expiration time.

Features

  • 0 dependencies
  • About 100 lines of code
  • 100% test coverage

Usage

// New cache
c := cache.New(5 * time.Minute)

// Put something into the cache
c.Set("a", "b", 1 * time.Minute)

// Read from the cache
obj, found := c.Get("a")

// Convert the type
fmt.Println(obj.(string))

Benchmarks

BenchmarkGet-12         300000000                3.88 ns/op            0 B/op          0 allocs/op
BenchmarkSet-12         10000000               183 ns/op              48 B/op          2 allocs/op
BenchmarkNew-12         10000000               112 ns/op             352 B/op          5 allocs/op

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric FungScott RayapoulléEduard Urbach
Cedric FungScott RayapoulléEduard Urbach

Want to see your own name here?

Frequently Asked Questions

What is cache?

cache is a Database library for the Go programming language. In-memory key:value store with expiration time, 0 dependencies, <100 LoC, 100% coverage.

How do I install cache?

Install cache with the Go module system using `go get akyoto/cache`. Check the repository for the current installation instructions.

What category does cache belong to?

cache is listed under Database, specifically Data stores with expiring records, in-memory distributed data stores, or in-memory subsets of file-based databases..

← Back to Data stores with expiring records, in-memory distributed data stores, or in-memory subsets of file-based databases.