Skip to content

freespace8/cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache

How to use it.

import (
  "github.com/freespace8/cache"
  "github.com/redis/go-redis/v9"
)

var rdb = redis.NewClient(&redis.Options{
  Addr: "localhost:6379",
  Username: "root",
  Password: "",
})

rc := cache.NewCache(rdb,
  cache.WithPrefix("cache:"),
  cache.WithDelay(0*time.Second),
)

rc.Fetch("key", 30*time.Second, func() (string, error) {
  time.Sleep(1*time.Second)
  return "value", nil
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages