Skip to content

frozzare/go-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache Build Status GoDoc Go Report Card

Go package for dealing with caching. Maybe not so fast.

Requires Go 1.9+ since the package is using type aliases.

Installation

$ go get -u github.com/frozzare/go-cache

Stores

  • Memory
  • Redis
  • Bolt

More cache stores can be implemented by using the provided store interface.

Example

package main

import (
	"log"

	"github.com/frozzare/go-cache"
	"github.com/frozzare/go-cache/store/redis"
)

func main() {
	c := cache.New(redis.NewStore(&redis.Options{
		Addr: "localhost:6379",
	}))

	if err := c.Set("name", "go"); err != nil {
		log.Fatal(err)
	}

	v, err := c.Get("name")
	if err != nil {
		log.Fatal(err)
	}

	log.Println(v)
}

License

MIT © Fredrik Forsmo

About

Go package for dealing with caching

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages