代码拉取完成,页面将自动刷新
package general_scope
import (
"time"
"gitee.com/carlmax_my/console-core-go/pkg/cache"
"gitee.com/carlmax_my/console-core-go/pkg/cache/scope"
)
type IGeneralScopeStore[T interface{}] interface {
Set(key, scope string, m *T) error
Get(key, scope string) (*T, error)
Del(key, scope string) (int64, error)
Exists(key, scope string) (bool, error)
CheckGet(key, scope string) (*T, error)
}
type GeneralScopeStore[T interface{}] struct {
scope.ScopeBaseStore
}
func NewWithTTL[T interface{}](cache cache.Cache, keyFunc scope.KeyFunc, ttl time.Duration) (IGeneralScopeStore[T], error) {
tenantStore, _ := scope.NewWithTTL(cache, keyFunc, ttl)
return &GeneralScopeStore[T]{
*tenantStore,
}, nil
}
func New[T interface{}](cache cache.Cache, keyFunc scope.KeyFunc) (IGeneralScopeStore[T], error) {
tenantStore, _ := scope.New(cache, keyFunc)
return &GeneralScopeStore[T]{
*tenantStore,
}, nil
}
func (s *GeneralScopeStore[T]) Set(key, scope string, m *T) error {
return s.SetModel(key, scope, m)
}
func (s *GeneralScopeStore[T]) Get(key, scope string) (*T, error) {
m := new(T)
if err := s.GetModel(key, scope, m); err != nil {
return nil, err
}
return m, nil
}
func (s *GeneralScopeStore[T]) CheckGet(key, scope string) (*T, error) {
m := new(T)
if err := s.CheckGetModel(key, scope, m); err != nil {
return nil, err
}
return m, nil
}
func (s *GeneralScopeStore[T]) Del(key, scope string) (int64, error) {
return s.ScopeBaseStore.Del(key, scope)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。