sksamuel / aedile

Kotlin Wrapper for Caffeine
Apache License 2.0
170 stars 15 forks source link

Divide cache wrappers to api and implementation #7

Open zTrap opened 1 year ago

sksamuel commented 1 year ago

What's the context for this change ?

zTrap commented 1 year ago

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 commented 1 year ago

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

sksamuel commented 1 year ago

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?