add 5 minute cache

This commit is contained in:
Asim Aslam
2021-06-15 21:05:38 +01:00
parent 4beafd5d3f
commit a5f5cd24cd
2 changed files with 33 additions and 4 deletions

View File

@@ -1,12 +1,14 @@
package main
import (
"github.com/micro/services/currency/handler"
pb "github.com/micro/services/currency/proto"
"time"
"github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/config"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/services/currency/handler"
pb "github.com/micro/services/currency/proto"
"github.com/patrickmn/go-cache"
)
func main() {
@@ -35,7 +37,8 @@ func main() {
// Register handler
pb.RegisterCurrencyHandler(srv.Server(), &handler.Currency{
Api: api + key,
Api: api + key,
Cache: cache.New(5*time.Minute, 10*time.Minute),
})
// Run service