github.com/polarismesh/polaris@v1.17.8/common/redispool/pool.go (about) 1 /** 2 * Tencent is pleased to support the open source community by making Polaris available. 3 * 4 * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 5 * 6 * Licensed under the BSD 3-Clause License (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * https://opensource.org/licenses/BSD-3-Clause 11 * 12 * Unless required by applicable law or agreed to in writing, software distributed 13 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 * specific language governing permissions and limitations under the License. 16 */ 17 18 package redispool 19 20 // Resp ckv任务结果 21 type Resp struct { 22 Value string 23 Err error 24 Exists bool 25 Compatible bool 26 shouldRetry bool 27 } 28 29 // RedisObject 序列化对象 30 type RedisObject interface { 31 // Serialize 序列化成字符串 32 Serialize(compatible bool) string 33 // Deserialize 反序列为对象 34 Deserialize(value string, compatible bool) error 35 } 36 37 type Pool interface { 38 // Start 启动ckv连接池工作 39 Start() 40 41 // Sdd 使用连接池,向redis发起Sdd请求 42 Sdd(id string, members []string) *Resp 43 44 // Srem 使用连接池,向redis发起Srem请求 45 Srem(id string, members []string) *Resp 46 47 // Get 使用连接池,向redis发起Get请求 48 Get(id string) *Resp 49 50 // Set 使用连接池,向redis发起Set请求 51 Set(id string, redisObj RedisObject) *Resp 52 53 // Del 使用连接池,向redis发起Del请求 54 Del(id string) *Resp 55 56 // RecoverTimeSec the time second record when recover 57 RecoverTimeSec() int64 58 }