aedile icon indicating copy to clipboard operation
aedile copied to clipboard

Divide cache wrappers to api and implementation

Open zTrap opened this issue 1 year ago • 4 comments

zTrap avatar Apr 04 '23 12:04 zTrap

What's the context for this change ?

sksamuel avatar Apr 04 '23 17:04 sksamuel

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 avatar Apr 04 '23 19:04 zTrap

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

zTrap avatar Apr 04 '23 19:04 zTrap

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?

sksamuel avatar Jul 02 '23 16:07 sksamuel