♻️ Rebuilt cache system with nexus cache

This commit is contained in:
2025-03-29 13:49:52 +08:00
parent 60d8c0b766
commit c8abf6647a
6 changed files with 55 additions and 523 deletions

View File

@ -2,10 +2,13 @@ package gap
import (
"fmt"
"strings"
"time"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/nex/cachekit"
"git.solsynth.dev/hypernet/pusher/pkg/pushkit/pushcon"
"github.com/samber/lo"
"strings"
"git.solsynth.dev/hypernet/nexus/pkg/proto"
"github.com/rs/zerolog/log"
@ -13,8 +16,11 @@ import (
"github.com/spf13/viper"
)
var Nx *nex.Conn
var Px *pushcon.Conn
var (
Nx *nex.Conn
Px *pushcon.Conn
Ca *cachekit.CaConn
)
func InitializeToNexus() error {
grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2)
@ -47,6 +53,10 @@ func InitializeToNexus() error {
return fmt.Errorf("error during initialize pushcon: %v", err)
}
return err
Ca, err = cachekit.NewCaConn(Nx, 3*time.Second)
if err != nil {
return fmt.Errorf("error during initialize cachekit: %v", err)
}
return err
}