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

more details in readme.md #99

Open
q3769 opened this issue Aug 3, 2021 · 3 comments
Open

more details in readme.md #99

q3769 opened this issue Aug 3, 2021 · 3 comments

Comments

@q3769
Copy link

q3769 commented Aug 3, 2021

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!

@garretwilson
Copy link

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.

@garretwilson
Copy link

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 additional spring.cache.* configuration was needed.
  • In my experiments I could not get Coffee Boot to fall back to the spring.cache.* properties (e.g. if a foo cache was defined with Coffee Boots but a bar cache was defined using the Spring properties); it would seem that the coffee-boots.* settings completely replace the spring.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 matching coffee-boots.* prefix" in order to switch back to Spring cache settings.

I agree that the documentation needs to be clarified and expanded a little.

@TheGeb
Copy link

TheGeb commented Sep 26, 2023

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

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

No branches or pull requests

3 participants