使用boot统一注册执行代码

This commit is contained in:
ayflying
2025-04-02 15:49:42 +08:00
parent 743d232c38
commit 75624ff0b7
6 changed files with 49 additions and 43 deletions

View File

@@ -4,8 +4,6 @@ import (
"github.com/ayflying/utility_go/pkg/aycache/drive"
drive2 "github.com/ayflying/utility_go/pkg/aycache/drive"
"github.com/gogf/gf/v2/os/gcache"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
type Mod struct {
@@ -14,14 +12,26 @@ type Mod struct {
var (
QPSCount int
QPS = promauto.NewGauge(
prometheus.GaugeOpts{
Name: "Cache_QPS",
Help: "当前缓存QPS数量",
},
)
//QPS = promauto.NewGauge(
// prometheus.GaugeOpts{
// Name: "Cache_QPS",
// Help: "当前缓存QPS数量",
// },
//)
)
func init() {
//boot.AddFunc(func() {
// //初始化指标
// service.SystemCron().AddCron(v1.CronType_MINUTE, func() error {
// QPS.Set(math.Round(float64(QPSCount) / 60))
// QPSCount = 0
// return nil
// })
//})
}
func New(_name ...string) gcache.Adapter {
var cacheAdapterObj gcache.Adapter