smartcache
The smartcache realizes smart in memory cache generation to minimize process blocks by using soft expire limit
Synopsis
var (
expire = 5*time.Minute
softExpire = 1*time.Minute
)
ca := smartcache.New(expire, softExpire, func(ctx context.Context) (interface{}, error) {
val, err := genCache(ctx)
return val, err
})
Description
In in-memory cache generation, there are problems, for example, thundering herd problems, blocking processing when regenerating or etc., but smartcache avoids them by setting a soft expire limit.
Installation
% go get github.com/Songmu/smartcache
Author
Songmu