more details in readme.md
q3769 opened this issue · 3 comments
I understand I can try this out by myself, but in the readme.md document, can you please clarify how exactly this works in concert with Spring Boot? E.g. when you say:
coffee-boots.cache.spec.myCache=maximumSize=100000,expireAfterWrite=1m
Is that "in addition to" spring boot's:
spring.cache.type=caffeine
spring.cache.cache-names=myCache,cache2,cache3
spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s
Or, does the coffee-boots.* properties completely replace spring.cache.* properties?
I hope it is in addition and not replacement. i.e. If I use "cache2" or "cache3" in my class annotation, I get the default/global spring configuration values (500 maxSize in this case); if I use "myCache" in my annotation, I get coffee-boot values (10000 maxSize). If it doesn't work that way, I'd like to request that it does.
Thanks!
Yes, a little more information in the readme would be helpful, especially to those who have never added any Spring cache before, and need to know is absolutely needed.
Some notes from my own experiments just now:
- If using Spring Boot and have not defined any specific caching beans,
spring.cache.type=caffeine
may not necessarily be needed, with or without Coffee Boots; see Spring Boot § 11.1.1. Supported Cache Providers and Spring Boot Caffeine. - Coffee Boot worked for me simply by adding the dependency and using something along the lines of
coffee-boots.cache.spec.myCache=maximumSize=100000,expireAfterWrite=1m
; no additionalspring.cache.*
configuration was needed. - In my experiments I could not get Coffee Boot to fall back to the
spring.cache.*
properties (e.g. if afoo
cache was defined with Coffee Boots but abar
cache was defined using the Spring properties); it would seem that thecoffee-boots.*
settings completely replace thespring.cache.*
properties, and the latter are ignored if the former are present. (I think the readme alludes to this when it says "… just remove all the properties matchingcoffee-boots.*
prefix" in order to switch back to Spring cache settings.
I agree that the documentation needs to be clarified and expanded a little.
The readme is also incorrect on this point:
"Use coffee-boots.cache.default-spec to define "basic" cache configuration with common key-value pairs to be reused by all other custom cache configurations. This allows simplifying custom configurations if necessary."
The code actually searches for coffee-boots.cache.basic-spec
, so specifying default-spec will have no effect