Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement BigCache? #78

Closed
Alcoholhaha opened this issue Aug 11, 2021 · 1 comment
Closed

How to implement BigCache? #78

Alcoholhaha opened this issue Aug 11, 2021 · 1 comment

Comments

@Alcoholhaha
Copy link

BigCache:
func (c *BigCache) Get(key string) ([]byte, error) {
// ...
}
func (c *BigCache) Set(key string, entry []byte) error {
// ...
}

But cache in dataloader:
func (c *NoCache) Get(context.Context, Key) (Thunk, bool) { return nil, false }
func (c *NoCache) Set(context.Context, Key, Thunk) { return }

So how do i implement BigCache in dataloader? How convert Thunk to []byte and []byte to Thunk?
Looking forward to your reply!

@pavelnikolov
Copy link
Member

See PR #84. It adds support for Generics and once merged you'll be able to use any type as the value - in your case Thunk[[]byte]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants