Skip to content

Commit

Permalink
Feat : Add ignored methods to get/set in redis
Browse files Browse the repository at this point in the history
  • Loading branch information
OBlackmon3 committed Oct 27, 2024
1 parent 28c9960 commit 4cda365
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions data/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ func (r *RedisConnector) Set(ctx context.Context, partitionKey, rangeKey, value

r.logger.Debug().Msgf("writing to Redis with partition key: %s and range key: %s", partitionKey, rangeKey)
method := strings.ToLower(strings.Split(rangeKey, ":")[0])

if _, found := r.ignoreMethod[method]; found {

return nil
}

ttl, found := r.ttls[method]
if !found {
ttl = time.Duration(0)
Expand All @@ -162,6 +168,12 @@ func (r *RedisConnector) Get(ctx context.Context, index, partitionKey, rangeKey
return "", fmt.Errorf("redis client not initialized yet")
}

method := strings.ToLower(strings.Split(rangeKey, ":")[0])
if _, found := r.ignoreMethod[method]; found {

return "", common.NewErrRecordNotFound("Method is uncacheable", RedisDriverName)
}

var err error
var value string

Expand Down

0 comments on commit 4cda365

Please sign in to comment.