Refactored code and added logging

This commit is contained in:
Artyom Belousov 2019-11-03 12:16:45 +03:00
parent 8830920900
commit 221ab214cc
11 changed files with 51 additions and 44 deletions

View file

@ -23,11 +23,11 @@ func GetClient() *CacheClient {
func (client *CacheClient) Init() {
client.storage = redis.NewClient(&redis.Options{
Addr: HOST_NAME,
Password: PASSWORD,
Addr: HostName,
Password: Password,
DB: 0,
})
client.Expiration = CACHE_EXPIRATION
client.Expiration = CacheExpiration
}
func (client *CacheClient) Set(key string, value string) {

View file

@ -4,6 +4,6 @@ import (
"time"
)
const HOST_NAME = "redis:6379"
const PASSWORD = ""
const CACHE_EXPIRATION = time.Hour * 24
const HostName = "redis:6379"
const Password = ""
const CacheExpiration = time.Hour * 24