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

Changed to use generics #16

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vertoforce
Copy link

Just playing around with how this would look if it used the new go generics.

Of course you lose some functionality in the ability to store anything, but in some cases it's nice to return the exact type you are expecting.

Not requesting this to be merged in, just posting.

}

// ConfigGeneric configures the cache.
type ConfigGeneric[T any] struct {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a new struct just to make this backwards compatible.
The only thing that isn't backwards compatible, is that now the methods return pointers instead of just interface{}

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

Successfully merging this pull request may close these issues.

1 participant