Documentation ¶
Index ¶
- Variables
- type ClearFunc
- type RefreshCache
- func (r *RefreshCache[T, A]) Clear(ctx context.Context, args ...A) error
- func (r *RefreshCache[T, A]) Data() *RefreshData[T, A]
- func (r *RefreshCache[T, A]) Get(ctx context.Context, args ...A) (data T, err error)
- func (r *RefreshCache[T, A]) GetRefreshFunc() RefreshFunc[T, A]
- func (r *RefreshCache[T, A]) Refresh(ctx context.Context, args ...A) (data T, err error)
- func (r *RefreshCache[T, A]) SetClearFunc(clearFunc ClearFunc[T, A])
- func (r *RefreshCache[T, A]) SetRefreshFunc(refreshFunc RefreshFunc[T, A])
- type RefreshData
- func (r *RefreshData[T, A]) Clear(ctx context.Context, clearFunc ClearFunc[T, A], args ...A) error
- func (r *RefreshData[T, A]) Get(ctx context.Context, refreshFunc RefreshFunc[T, A], args ...A) (data T, err error)
- func (r *RefreshData[T, A]) Last() int64
- func (r *RefreshData[T, A]) LastErr() int64
- func (r *RefreshData[T, A]) LastErrTime() time.Time
- func (r *RefreshData[T, A]) LastTime() time.Time
- func (r *RefreshData[T, A]) MaxAge() int64
- func (r *RefreshData[T, A]) MaxErrAge() int64
- func (r *RefreshData[T, A]) Raw() (data T, err error)
- func (r *RefreshData[T, A]) Refresh(ctx context.Context, refreshFunc RefreshFunc[T, A], args ...A) (data T, err error)
- type RefreshDataOption
- type RefreshFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var OldValKey = oldVal{}
Functions ¶
This section is empty.
Types ¶
type RefreshCache ¶
type RefreshCache[T any, A any] struct { *RefreshData[T, A] RefreshFunc atomic.Pointer[RefreshFunc[T, A]] ClearFunc atomic.Pointer[ClearFunc[T, A]] }
func NewRefreshCache ¶
func NewRefreshCache[T any, A any](refreshFunc RefreshFunc[T, A], maxAge time.Duration, opts ...RefreshDataOption[T, A]) *RefreshCache[T, A]
func (*RefreshCache[T, A]) Clear ¶
func (r *RefreshCache[T, A]) Clear(ctx context.Context, args ...A) error
func (*RefreshCache[T, A]) Data ¶
func (r *RefreshCache[T, A]) Data() *RefreshData[T, A]
func (*RefreshCache[T, A]) Get ¶
func (r *RefreshCache[T, A]) Get(ctx context.Context, args ...A) (data T, err error)
func (*RefreshCache[T, A]) GetRefreshFunc ¶
func (r *RefreshCache[T, A]) GetRefreshFunc() RefreshFunc[T, A]
func (*RefreshCache[T, A]) Refresh ¶
func (r *RefreshCache[T, A]) Refresh(ctx context.Context, args ...A) (data T, err error)
func (*RefreshCache[T, A]) SetClearFunc ¶
func (r *RefreshCache[T, A]) SetClearFunc(clearFunc ClearFunc[T, A])
func (*RefreshCache[T, A]) SetRefreshFunc ¶
func (r *RefreshCache[T, A]) SetRefreshFunc(refreshFunc RefreshFunc[T, A])
type RefreshData ¶
func NewRefreshData ¶
func NewRefreshData[T any, A any](maxAge time.Duration, opts ...RefreshDataOption[T, A]) *RefreshData[T, A]
func (*RefreshData[T, A]) Clear ¶
func (r *RefreshData[T, A]) Clear(ctx context.Context, clearFunc ClearFunc[T, A], args ...A) error
func (*RefreshData[T, A]) Get ¶
func (r *RefreshData[T, A]) Get(ctx context.Context, refreshFunc RefreshFunc[T, A], args ...A) (data T, err error)
func (*RefreshData[T, A]) Last ¶
func (r *RefreshData[T, A]) Last() int64
func (*RefreshData[T, A]) LastErr ¶
func (r *RefreshData[T, A]) LastErr() int64
func (*RefreshData[T, A]) LastErrTime ¶
func (r *RefreshData[T, A]) LastErrTime() time.Time
func (*RefreshData[T, A]) LastTime ¶
func (r *RefreshData[T, A]) LastTime() time.Time
func (*RefreshData[T, A]) MaxAge ¶
func (r *RefreshData[T, A]) MaxAge() int64
func (*RefreshData[T, A]) MaxErrAge ¶
func (r *RefreshData[T, A]) MaxErrAge() int64
func (*RefreshData[T, A]) Raw ¶
func (r *RefreshData[T, A]) Raw() (data T, err error)
func (*RefreshData[T, A]) Refresh ¶
func (r *RefreshData[T, A]) Refresh(ctx context.Context, refreshFunc RefreshFunc[T, A], args ...A) (data T, err error)
type RefreshDataOption ¶
type RefreshDataOption[T any, A any] func(*RefreshData[T, A])
func WithErrAge ¶
func WithErrAge[T any, A any](age time.Duration) RefreshDataOption[T, A]
Click to show internal directories.
Click to hide internal directories.