diff --git a/cache/cache.go b/cache/cache.go index c487d03..5f51ac5 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -7,7 +7,7 @@ import ( "github.com/allegro/bigcache/v3" ) -var cache *bigcache.BigCache +var mc *bigcache.BigCache // Init ... func Init() { @@ -17,7 +17,7 @@ func Init() { if err != nil { log.Fatalf("Cannot init Cache %v", err) } - cache = c + mc = c // Cache roles Roles() @@ -25,5 +25,5 @@ func Init() { // GetInstance ... func GetInstance() *bigcache.BigCache { - return cache + return mc } diff --git a/cache/role.go b/cache/role.go index b4908d2..7f08d5e 100644 --- a/cache/role.go +++ b/cache/role.go @@ -40,7 +40,7 @@ func Roles() { IsAdmin: role.IsAdmin, Permissions: rolePermissions, }) - if err := cache.Set(role.ID.Hex(), entry); err != nil { + if err := mc.Set(role.ID.Hex(), entry); err != nil { logger.Error("usermngmt - CacheRole", logger.LogData{ "err": err.Error(), }) @@ -55,10 +55,10 @@ func Roles() { // GetCachedRole ... func GetCachedRole(key string) CachedRole { - entry, err := cache.Get(key) + entry, err := mc.Get(key) if err != nil { Roles() - entry, _ = cache.Get(key) + entry, _ = mc.Get(key) } var cachedRole CachedRole if err = json.Unmarshal(entry, &cachedRole); err != nil {