Skip to content

Commit e1fe88c

Browse files
Implement RCM code
Signed-off-by: Niranjani Vivek <niranjaniv@google.com>
1 parent 5b93368 commit e1fe88c

File tree

7 files changed

+597
-6
lines changed

7 files changed

+597
-6
lines changed

translib/db/db.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ type Options struct {
168168
KeySeparator string //Overriden by the DB config file's separator.
169169
IsWriteDisabled bool //Is write/set mode disabled ?
170170
IsCacheEnabled bool //Is cache (Per Connection) allowed?
171+
// Redis connection pools do not support transactional Redis operations.
172+
// If the DB object will be used to perform transactions, the Transacation
173+
// flag must be set to request a unique Redis client. Transactions include
174+
// SCAN and MULTI.
175+
TransactionsRequired bool
171176

172177
// OnChange caching for the DBs passed from Translib's Subscribe Infra
173178
// to the Apps. SDB is the SubscribeDB() returned handle on which

translib/db/db_redis_opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func adjustRedisOpts(dbOpt *Options) *redis.Options {
144144
return &redisOpts
145145
}
146146

147-
func init() {
147+
func initializeRedisOpts() {
148148
flag.StringVar(&goRedisOpts, "go_redis_opts", "", "Options for go-redis")
149149
}
150150

translib/db/db_stats.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
package db
2121

2222
import (
23+
"github.com/go-redis/redis/v7"
2324
"reflect"
2425
"sync"
2526
"time"
26-
27-
"github.com/go-redis/redis/v7"
2827
)
2928

3029
////////////////////////////////////////////////////////////////////////////////
@@ -543,10 +542,7 @@ func readRedis(key string) (map[string]string, error) {
543542
DialTimeout: 0,
544543
PoolSize: 1,
545544
})
546-
547545
fields, e := client.HGetAll(key).Result()
548-
549546
client.Close()
550-
551547
return fields, e
552548
}

0 commit comments

Comments
 (0)