Documentation ¶
Index ¶
- Variables
- func InitCache(ctx context.Context, eviction time.Duration) error
- func Remove(id string)
- type CacheData
- type CacheLife
- type CachedData
- type CachedList
- func (list *CachedList[T]) Append(data []T, at int)
- func (list *CachedList[T]) Clear()
- func (list *CachedList[T]) Count() (page int, num int)
- func (list *CachedList[T]) First() []T
- func (list *CachedList[T]) GetPage(page int, getData func(page int) ([]T, error)) (listData []T, err error)
- func (list *CachedList[T]) Last() []T
- func (list *CachedList[T]) Length() int
- type ExpireError
- type ListElement
- type PageOutOfRangeError
Constants ¶
This section is empty.
Variables ¶
View Source
var Cache *bigcache.BigCache
Functions ¶
Types ¶
type CacheData ¶ added in v0.0.3
type CachedData ¶
func NewCachedData ¶
func NewCachedData[T any](lifeTime int64) *CachedData[T]
func (*CachedData[T]) Clear ¶ added in v0.0.3
func (data *CachedData[T]) Clear()
func (*CachedData[T]) Get ¶ added in v0.0.3
func (data *CachedData[T]) Get(onExpire func() (*T, error)) (*T, error)
func (*CachedData[T]) Set ¶ added in v0.0.3
func (data *CachedData[T]) Set(d *T)
type CachedList ¶
func NewCachedList ¶
func NewCachedList[T any](lifeTime int64, capacity int) *CachedList[T]
func (*CachedList[T]) Append ¶ added in v0.0.3
func (list *CachedList[T]) Append(data []T, at int)
func (*CachedList[T]) Count ¶ added in v0.0.3
func (list *CachedList[T]) Count() (page int, num int)
return last element of cached list
func (*CachedList[T]) First ¶ added in v0.0.3
func (list *CachedList[T]) First() []T
return first element of cached list
func (*CachedList[T]) GetPage ¶ added in v0.0.3
func (list *CachedList[T]) GetPage(page int, getData func(page int) ([]T, error)) (listData []T, err error)
get list from specific index
func (*CachedList[T]) Last ¶ added in v0.0.3
func (list *CachedList[T]) Last() []T
return last element of cached list
func (*CachedList[T]) Length ¶ added in v0.0.3
func (list *CachedList[T]) Length() int
get length of cached list
type ExpireError ¶
type ExpireError struct { }
func NewExpireError ¶
func NewExpireError() *ExpireError
func (*ExpireError) Error ¶
func (e *ExpireError) Error() string
type ListElement ¶
type ListElement interface {
GetUID() string
}
type PageOutOfRangeError ¶
type PageOutOfRangeError struct { }
func NewPageOutOfRangeError ¶
func NewPageOutOfRangeError() *PageOutOfRangeError
func (*PageOutOfRangeError) Error ¶
func (e *PageOutOfRangeError) Error() string
Click to show internal directories.
Click to hide internal directories.