mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 15:20:25 +08:00
实现修改缓存配置
This commit is contained in:
@@ -33,6 +33,7 @@ type RPCClient struct {
|
||||
httpHeaderClients []pb.HTTPHeaderServiceClient
|
||||
httpPageClients []pb.HTTPPageServiceClient
|
||||
httpAccessLogPolicyClients []pb.HTTPAccessLogPolicyServiceClient
|
||||
httpCachePolicyClients []pb.HTTPCachePolicyServiceClient
|
||||
}
|
||||
|
||||
func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
|
||||
@@ -55,6 +56,7 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
|
||||
httpHeaderClients := []pb.HTTPHeaderServiceClient{}
|
||||
httpPageClients := []pb.HTTPPageServiceClient{}
|
||||
httpAccessLogPolicyClients := []pb.HTTPAccessLogPolicyServiceClient{}
|
||||
httpCachePolicyClients := []pb.HTTPCachePolicyServiceClient{}
|
||||
|
||||
conns := []*grpc.ClientConn{}
|
||||
for _, endpoint := range apiConfig.RPC.Endpoints {
|
||||
@@ -85,6 +87,7 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
|
||||
httpHeaderClients = append(httpHeaderClients, pb.NewHTTPHeaderServiceClient(conn))
|
||||
httpPageClients = append(httpPageClients, pb.NewHTTPPageServiceClient(conn))
|
||||
httpAccessLogPolicyClients = append(httpAccessLogPolicyClients, pb.NewHTTPAccessLogPolicyServiceClient(conn))
|
||||
httpCachePolicyClients = append(httpCachePolicyClients, pb.NewHTTPCachePolicyServiceClient(conn))
|
||||
}
|
||||
|
||||
return &RPCClient{
|
||||
@@ -104,6 +107,7 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
|
||||
httpHeaderClients: httpHeaderClients,
|
||||
httpPageClients: httpPageClients,
|
||||
httpAccessLogPolicyClients: httpAccessLogPolicyClients,
|
||||
httpCachePolicyClients: httpCachePolicyClients,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -212,6 +216,13 @@ func (this *RPCClient) HTTPAccessLogPolicyRPC() pb.HTTPAccessLogPolicyServiceCli
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *RPCClient) HTTPCachePolicyRPC() pb.HTTPCachePolicyServiceClient {
|
||||
if len(this.httpCachePolicyClients) > 0 {
|
||||
return this.httpCachePolicyClients[rands.Int(0, len(this.httpCachePolicyClients)-1)]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *RPCClient) Context(adminId int64) context.Context {
|
||||
ctx := context.Background()
|
||||
m := maps.Map{
|
||||
|
||||
Reference in New Issue
Block a user