diff --git a/README.md b/README.md index 2807f71..4bd1f65 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ func main() { // Use Redis for caching RedisOptions: &geofencecache.RedisOptions{ Addr: "localhost:6379", + Username: "", // no username set Password: "", // no password set DB: 0, // use default DB }, diff --git a/cache/redis.go b/cache/redis.go index e276e91..cc55aee 100644 --- a/cache/redis.go +++ b/cache/redis.go @@ -17,6 +17,7 @@ type RedisCache struct { // RedisOptions holds redis configuration parameters. type RedisOptions struct { Addr string + Username string Password string DB int TTL time.Duration @@ -27,6 +28,7 @@ func NewRedisCache(redisOpts *RedisOptions) *RedisCache { return &RedisCache{ redisClient: redis.NewClient(&redis.Options{ Addr: redisOpts.Addr, + Username: redisOpts.Username, Password: redisOpts.Password, DB: redisOpts.DB, }),