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

Divide cache wrappers to api and implementation #7

Open
zTrap opened this issue Apr 4, 2023 · 4 comments
Open

Divide cache wrappers to api and implementation #7

zTrap opened this issue Apr 4, 2023 · 4 comments

Comments

@zTrap
Copy link

zTrap commented Apr 4, 2023

No description provided.

@sksamuel
Copy link
Owner

sksamuel commented Apr 4, 2023

What's the context for this change ?

@zTrap
Copy link
Author

zTrap commented Apr 4, 2023

Actually it is the best practice for all public shared code 🙂 Dividing makes able to use kotlin's interface delegation e.g

class SharedCache<K, V>(impl: CacheWrapper<K, V>) : CacheWrapper<K, V> by impl, AnotherInterface

@zTrap
Copy link
Author

zTrap commented Apr 4, 2023

Also after this changes both wrappers will be acceptable for wildcards. Since they implements single parent interface CacheWrapper<K, V>

@sksamuel
Copy link
Owner

sksamuel commented Jul 2, 2023

I'm not really a fan of interfaces where they are not needed. You can easily test code using the caeffine builder, since it's in memory, so the "mock" use case isn't needed. What else is having an interface buying us?

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 a pull request may close this issue.

2 participants