GITLAB

Hermes / api-game

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • api-game_qianyi
  • util
  • zredis
  • kv.go
  • ef31119a   refactor♻️:项目目录重构 Browse Code »
    王家文
    2024-04-16 14:05:30 +0800  
kv.go 267 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package zredis

import (
	"github.com/gomodule/redigo/redis"
)

func Increment(key string) int64 {
	conn := GetConn()
	if conn == nil {
		return 0
	}
	defer conn.Close()

	value, err := redis.Int64(conn.Do("INCR", key))
	if err == nil {
		return value
	}
	return 0
}