1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-24 22:26:54 +02:00

Add cache example (#2232)

This commit is contained in:
Niek den Breeje
2021-09-01 11:08:43 +02:00
committed by GitHub
parent 05a299b76c
commit ed9053ed94
9 changed files with 805 additions and 4 deletions

31
examples/cache/main.go vendored Normal file
View File

@ -0,0 +1,31 @@
package main
import (
"github.com/asim/go-micro/examples/v3/cache/handler"
pb "github.com/asim/go-micro/examples/v3/cache/proto"
"github.com/asim/go-micro/v3"
log "github.com/asim/go-micro/v3/logger"
)
var (
service = "go.micro.srv.cache"
version = "latest"
)
func main() {
// Create service
srv := micro.NewService(
micro.Name(service),
micro.Version(version),
)
srv.Init()
// Register handler
pb.RegisterCacheHandler(srv.Server(), handler.NewCache())
// Run service
if err := srv.Run(); err != nil {
log.Fatal(err)
}
}