Documentation ¶
Index ¶
- Variables
- type Store
- func (ts *Store) Commission(ctx context.Context, t time.Duration, key string, data interface{}) (string, error)
- func (ts *Store) Decommission(ctx context.Context, token string, data interface{}) error
- func (ts *Store) Extend(ctx context.Context, token string, timeout time.Duration, data interface{}) error
- func (ts *Store) Peek(ctx context.Context, token string, data interface{}) error
- func (ts *Store) Reset(ctx context.Context, key string, data interface{}) error
- func (ts *Store) Revoke(ctx context.Context, key string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrTokenNotFound = errors.New("The passed token has either expired or never existed")
)
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Commission ¶
func (ts *Store) Commission(ctx context.Context, t time.Duration, key string, data interface{}) (string, error)
Commission creates a single use token that expires after the given timeout.
func (*Store) Decommission ¶
Decommission loads the value referenced by the token and dispenses of the token, making it unvailable for further use.
func (*Store) Extend ¶
func (ts *Store) Extend(ctx context.Context, token string, timeout time.Duration, data interface{}) error
Extend sets the new duration before an existing token times out. Note that it doesn't take into account how long the old token had to expire, as it uses the new duration entirely.
Click to show internal directories.
Click to hide internal directories.