Skip to content

pharosnet/pharoscache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

  • Pharos cache is a lru cache for Go(Golang).
  • Thread safety without mutex.

Example

The simplest way to use pharos cache:

package main

import (
	"github.com/pharosnet/pharoscache"
	"fmt"
)

func main() {
        c := pharoscache.NewCache(&pharoscache.Option{MaxEntries:10})
        c.Bucket("name").Set("key", []byte("value"), 0)
        fmt.Println(c.Bucket("name").Get("key"))
        c.Close()	
}

Thread safety

Pharos cache is protected by chan for concurrent getters and setters.

Releases

No releases published

Packages

No packages published

Languages