fix comment again

This commit is contained in:
Hoang 2021-11-11 16:58:44 +07:00
parent 4ee176b9e0
commit 45e9f71a3f
2 changed files with 6 additions and 6 deletions

6
cache/cache.go vendored
View File

@ -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
}

6
cache/role.go vendored
View File

@ -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 {