Files
services/examples/cache/increment/go/incrementAValue.go

19 lines
388 B
Go
Executable File

package example
import (
"fmt"
"os"
"github.com/micro/services/clients/go/cache"
)
// Increment a value (if it's a number). If key not found it is equivalent to set.
func IncrementAvalue() {
cacheService := cache.NewCacheService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := cacheService.Increment(&cache.IncrementRequest{
Key: "counter",
Value: 2,
})
fmt.Println(rsp, err)
}