question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use simple cache instead of Guava's?

See original GitHub issue

I am packaging my app without springfox, in the production profile, and would now like to get rid of the large guava dependency.

However, it’s being used by PersistentTokenRememberMeServices.java (for session authentication) and OAuth2AuthenticationService.java (for gateway/uaa authentication).

But it seems to me that in those places, it is actually a bit heavy-handed to use guava’s Cache class – which is specifically designed to be safe for use by multiple concurrent threads, but here we are bluntly synchronizing on a global lock around it!

https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/src/main/java/package/security/_PersistentTokenRememberMeServices.java#L118 https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/src/main/java/package/security/oauth2/_OAuth2AuthenticationService.java#L151

Would you consider a PR which replaces this use of guava’s cache by a simple custom implementation? It’s basically just a map with a maintenance thread. I have it mostly done already, and it works like a charm.

But I figured I’d check first, before I spend too much time polishing it and adding unit tests 😃

  • Checking this box is mandatory (this is just to show you read everything)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (19 by maintainers)

github_iconTop GitHub Comments

4reactions
ben-manescommented, Nov 20, 2017

Please let me know if I can be of any help wrt Caffeine.

0reactions
jduboiscommented, Jan 9, 2018

Awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guava Cache - Baeldung
How to use the Guava Cache - from a simple usecase to eviction of elements, refresh and preload of the cache and removal...
Read more >
Implementing Caching Service in Spring Boot using Guava ...
Guava Cache is a library provided by Google to implement a simple in-process Cache Store. Guava Cache is an incremental cache, more like ......
Read more >
31. Caching - Spring
If Guava is present, a GuavaCacheManager is auto-configured. Caches can be created on startup using the spring.cache.cache-names property and customized by one ...
Read more >
Why did Spring framework deprecate the use of Guava cache?
I want to use spring-cache with guava cache, but I find guava cache has been marked deprecated by spring official document.
Read more >
Spring Caching Abstraction and Google Guava Cache - DZone
This approach works very nicely, if required certain caches can be configured to be backed by a different caching engines itself, say a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found