Closed Alcoholhaha closed 2 years ago
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!
See PR https://github.com/graph-gophers/dataloader/pull/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]
Thunk[[]byte]
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!