Files
mostlymatter/vendor/github.com/graph-gophers/dataloader/v6/cache.go
Agniva De Sarker 56dfcddff5 MM-43143: Dataloaders for roles (#19936)
We use a dataloader to optimize roles loading.

https://mattermost.atlassian.net/browse/MM-43143

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-08 15:32:35 +05:30

29 строки
782 B
Go

package dataloader
import "context"
// The Cache interface. If a custom cache is provided, it must implement this interface.
type Cache interface {
Get(context.Context, Key) (Thunk, bool)
Set(context.Context, Key, Thunk)
Delete(context.Context, Key) bool
Clear()
}
// NoCache implements Cache interface where all methods are noops.
// This is useful for when you don't want to cache items but still
// want to use a data loader
type NoCache struct{}
// Get is a NOOP
func (c *NoCache) Get(context.Context, Key) (Thunk, bool) { return nil, false }
// Set is a NOOP
func (c *NoCache) Set(context.Context, Key, Thunk) { return }
// Delete is a NOOP
func (c *NoCache) Delete(context.Context, Key) bool { return false }
// Clear is a NOOP
func (c *NoCache) Clear() { return }