bigcache GetWithTTL not supported
melpomene opened this issue · comments
The bigcache implementation of GetWithTTL is just a hard coded 0 duration but with no indication in API it will not work as intended.
I suggest instead returning an error that lets the user know that the method is in fact not supported and it should not be relied upon.
Current behavior:
// GetWithTTL returns data stored from a given key and its corresponding TTL
func (s *BigcacheStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error) {
item, err := s.Get(ctx, key)
return item, 0, err
}
Proposed change:
ErrNotImplemented = errors.New("Method not implemented for codec")
// GetWithTTL returns data stored from a given key and its corresponding TTL
func (s *BigcacheStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error) {
return nil, 0, store.ErrNotImplemented
}
Hi @melpomene,
Thank you for your feedback.
I agree that this API could be marked as not implemented and precise that the Get() method have to be use.
Please feel free to submit a pull request to change this behavior.
Thanks
BUT when chain bigcache with Redis, it broker our services.
@melpomene I think @exherb is right.
I don't have this in mind but we should keep this method implemented, whereas throwing an error.