statics file change
This commit is contained in:
@@ -119,12 +119,8 @@ func (s *departmentService) List(ctx context.Context, q dto.SearchDto) ([]*syste
|
||||
}
|
||||
|
||||
func (s *departmentService) RefreshCache(ctx context.Context) error {
|
||||
var res []*system.Department
|
||||
key := know.GetManageKey(ctx, know.AllDepartments)
|
||||
err := util.GetOrSetCache(ctx, s.Redis, key, util.GetCacheExpire(), func() (any, error) {
|
||||
return s.All(ctx)
|
||||
}, &res)
|
||||
return err
|
||||
return s.Redis.Del(ctx, key)
|
||||
}
|
||||
|
||||
func (s *departmentService) RebuildParentPath(ctx context.Context) error {
|
||||
|
||||
@@ -191,12 +191,8 @@ func (s *menuService) SetRoleMenu(ctx context.Context, roleID int32, rms []*syst
|
||||
}
|
||||
|
||||
func (s *menuService) RefreshCache(ctx context.Context) error {
|
||||
var res []*system.Menu
|
||||
key := know.GetManageKey(ctx, know.AllMenus)
|
||||
getData := func() (any, error) {
|
||||
return s.repo.All(ctx)
|
||||
}
|
||||
return util.GetOrSetCache(ctx, s.Redis, key, util.GetCacheExpire(), getData, &res)
|
||||
return s.Redis.Del(ctx, key)
|
||||
}
|
||||
|
||||
func (s *menuService) RebuildParentPath(ctx context.Context) error {
|
||||
|
||||
@@ -122,14 +122,8 @@ func (s *roleService) List(ctx context.Context, q dto.SearchDto) ([]*system.Role
|
||||
}
|
||||
|
||||
func (s *roleService) RefreshCache(ctx context.Context) error {
|
||||
var res []*system.Role
|
||||
key := know.GetManageKey(ctx, know.AllRoles)
|
||||
if err := s.Redis.Del(ctx, key); err != nil {
|
||||
return err
|
||||
}
|
||||
return util.GetOrSetCache(ctx, s.Redis, key, util.GetCacheExpire(), func() (any, error) {
|
||||
return s.repo.All(ctx)
|
||||
}, &res)
|
||||
return s.Redis.Del(ctx, key)
|
||||
}
|
||||
|
||||
func (s *roleService) RebuildParentPath(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user