diff --git a/cache/instrumented_redis.go b/cache/instrumented_redis.go index 9c7b83e9..032d2f1f 100755 --- a/cache/instrumented_redis.go +++ b/cache/instrumented_redis.go @@ -67,7 +67,7 @@ func (_d RedisClientWithPrometheus) FlushAll(ctx context.Context) (err error) { } // Get implements RedisClient -func (_d RedisClientWithPrometheus) Get(ctx context.Context, key string, delete bool) (s1 string, err error) { +func (_d RedisClientWithPrometheus) Get(ctx context.Context, key string, deleteAfterGet bool) (s1 string, err error) { _since := time.Now() defer func() { result := "ok" @@ -77,7 +77,7 @@ func (_d RedisClientWithPrometheus) Get(ctx context.Context, key string, delete redisclientDurationSummaryVec.WithLabelValues(_d.instanceName, "Get", result).Observe(time.Since(_since).Seconds()) }() - return _d.base.Get(ctx, key, delete) + return _d.base.Get(ctx, key, deleteAfterGet) } // Set implements RedisClient diff --git a/cache/redis.go b/cache/redis.go index 5aa9fbf2..430afbcd 100644 --- a/cache/redis.go +++ b/cache/redis.go @@ -15,7 +15,7 @@ import ( type RedisClient interface { Set(ctx context.Context, key string, val string, ttl time.Duration) error Incr(ctx context.Context, key string, subtract bool) (int, error) - Get(ctx context.Context, key string, delete bool) (string, error) + Get(ctx context.Context, key string, deleteAfterGet bool) (string, error) Del(ctx context.Context, keys ...string) error FlushAll(ctx context.Context) error } @@ -78,9 +78,9 @@ func (r *redisSimpleClient) Incr(ctx context.Context, key string, subtract bool) return int(val), err } -func (r *redisSimpleClient) Get(ctx context.Context, key string, delete bool) (string, error) { +func (r *redisSimpleClient) Get(ctx context.Context, key string, deleteAfterGet bool) (string, error) { var res *redis.StringCmd - if delete { + if deleteAfterGet { res = r.client.GetDel(ctx, key) } else { res = r.client.Get(ctx, key) @@ -115,9 +115,9 @@ func (r *redisClusterClient) Incr(ctx context.Context, key string, subtract bool return int(val), err } -func (r *redisClusterClient) Get(ctx context.Context, key string, delete bool) (string, error) { +func (r *redisClusterClient) Get(ctx context.Context, key string, deleteAfterGet bool) (string, error) { var res *redis.StringCmd - if delete { + if deleteAfterGet { res = r.client.GetDel(ctx, key) } else { res = r.client.Get(ctx, key) diff --git a/datastore/datastore.go b/datastore/datastore.go index 04796120..5e3e5451 100644 --- a/datastore/datastore.go +++ b/datastore/datastore.go @@ -7,7 +7,7 @@ type Datastore interface { // Insert a series of sync entities in a write transaction. InsertSyncEntitiesWithServerTags(entities []*SyncEntity) error // Update an existing sync entity. - UpdateSyncEntity(entity *SyncEntity, oldVersion int64) (conflict bool, delete bool, err error) + UpdateSyncEntity(entity *SyncEntity, oldVersion int64) (conflict bool, deleted bool, err error) // Get updates for a specific type which are modified after the time of // client token for a given client. Besides the array of sync entities, a // boolean value indicating whether there are more updates to query in the diff --git a/datastore/datastoretest/mock_datastore.go b/datastore/datastoretest/mock_datastore.go index 60e8e854..09665d40 100644 --- a/datastore/datastoretest/mock_datastore.go +++ b/datastore/datastoretest/mock_datastore.go @@ -23,7 +23,7 @@ func (m *MockDatastore) InsertSyncEntitiesWithServerTags(entities []*datastore.S } // UpdateSyncEntity mocks calls to UpdateSyncEntity -func (m *MockDatastore) UpdateSyncEntity(entity *datastore.SyncEntity, oldVersion int64) (conflict bool, delete bool, err error) { +func (m *MockDatastore) UpdateSyncEntity(entity *datastore.SyncEntity, oldVersion int64) (conflict bool, deleted bool, err error) { args := m.Called(entity, oldVersion) return args.Bool(0), args.Bool(1), args.Error(2) } diff --git a/datastore/instrumented_datastore.go b/datastore/instrumented_datastore.go index 6ce5efe7..e2e82732 100644 --- a/datastore/instrumented_datastore.go +++ b/datastore/instrumented_datastore.go @@ -178,7 +178,7 @@ func (_d DatastoreWithPrometheus) UpdateClientItemCount(counts *ClientItemCounts } // UpdateSyncEntity implements Datastore -func (_d DatastoreWithPrometheus) UpdateSyncEntity(entity *SyncEntity, oldVersion int64) (conflict bool, delete bool, err error) { +func (_d DatastoreWithPrometheus) UpdateSyncEntity(entity *SyncEntity, oldVersion int64) (conflict bool, deleted bool, err error) { _since := time.Now() defer func() { result := "ok"