Documentation ¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[E any] interface { // Insert creates a new unique token for the request object and returns it. If it's not possible to generate // a unique token, an error is returned. Insert(req E) (token string, err error) // Consume looks up the cache for the request associated with the given token and returns it if found. // If the token is unknown or expired, no request & found = false is returned. Consume(token string) (req E, found bool) }
Cache associates requests of type E with request tokens. This allows requests to be approved and later on be picked up with their associated token.
func NewCache ¶
func NewCache[E any](opts ...func(*CacheOptions)) Cache[E]
NewCache constructs a new Cache that tracks request tokens with requests of type E.
Click to show internal directories.
Click to hide internal directories.