Skip to content

csturiale/cacher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cacher

Cacher is an interface on top of different databases

How to use

go get github.com/csturiale/cacher

REDIS

opts := cache.Options{
    Server:   localhost,
    Port:     6379,
    Password: "",
    Prefix:   "myprefix",
    DB:       0
}
	
db, err = cache.New(&cache.RedisCache{}, &opts)
if err != nil {
	log.Fatalf("Cannot connect to redis")
}

BADGER

opts := cache.Options{
    Path:   "badger"
}
db, err = cache.New(&cache.BadgerCache{}, &opts)
if err != nil {
	log.Fatalf("Cannot connect to Badger")
}

BUNTDB

opts := cache.Options{
    Path:   ":memory:" // For in memory DB, otherwise you can set a path
}
db, err = cache.New(&cache.BuntDBCache{}, &opts)
if err != nil {
	log.Fatalf("Cannot connect to BuntDB")
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages