Questions tagged [google-guava-cache]
97 questions
0
votes
1 answer
How to reliably drop records from Guava LoadingCache?
I am using Guava LoadingCache to populate some data into it and I want to remove all the entries from that LoadingCache every 1 minute.
public class MetricHolder {
private final ExecutorService executor = Executors.newFixedThreadPool(2);
private…

john
- 11,311
- 40
- 131
- 251
0
votes
1 answer
Empty guava cache size?
Just wondering if the system pre-allocate any space for empty guava cache? I am new to guava cache, can someone help me to understand this problem?
Also I test it with code below:
long preMemUsage = Runtime.getRuntime().totalMemory()…

Nathan
- 95
- 1
- 2
- 10
0
votes
0 answers
Google Guava CacheBuilder - Issue With Bulk Load From MongoDB Collection
I'm trying to override Google Guava's CacheLoader loadAll() method. I'm wanting to do a bulk lookup and retrieve all the documents in the Employee collection that were not specifically requested like it states in CachesExplained:
Note that you can…

jdub7
- 25
- 1
- 11
0
votes
1 answer
java cacheing - choice between using a Map and using a Graph
in my java Spring application, I need to build an in-process / in-memory cache of some configuration metadata, which is structured like this:
Graph customerMetadata>:
"My Customer" "CustomerInfo":
…

Eugene Goldberg
- 14,286
- 20
- 94
- 167
0
votes
1 answer
How does timed cache expiry work?
I know that Guava Cache allows individual caches to be configured with an expiry time. Does Guava do this using a timer that wakes up after a configured number of seconds to invalidate the cache?
I have a transaction that is long-running. Whatever…

Yash
- 946
- 1
- 13
- 28
0
votes
1 answer
How to use CacheBuiler from Guava as a ConcurrentLRUCache
so im using CacheBuilder by Guava as a ConcurrentLRUCache meaning this cache is thread safe and has LRU properties, see CacheBuilder Guava Docs.
My assumption is when multiple threads are launched concurrently having the same key, a CyclicBarrier…
0
votes
0 answers
How to use Guava LoadingCache to detect Event Frequency
I have a requirement to detect event frequency, e.g. N identical events have occurred within X seconds.
My detection process executes continually 24/7.
My initial design employed a ConcurrentHashMap, The key is a custom value object that represents…

Hector
- 4,016
- 21
- 112
- 211
0
votes
1 answer
Strange Behavior for Spring cache guava TTL config
I have following spring cache config:
spring.cache.guava.spec: expireAfterWrite=1s
Then I have test for it:
@Test
public void test_not_work() {
callCachedMethod(..);
sleep(2s);
callCachedMethod(..);
expect("real method called TWO times");…

Jaiwo99
- 9,687
- 3
- 36
- 53
0
votes
2 answers
Can weakValues() and expireAfterAccess() be combined?
I want to do something like this:
CacheBuilder
.newBuilder()
.maximumSize(CONFIG.cacheMaxSize())
.expireAfterAccess(CONFIG.cacheTimeout(),
CONFIG.cacheTimeUnit())
…

jacob
- 2,762
- 1
- 20
- 49
0
votes
1 answer
Where is google guava cache storing values?..Is it safe to use it in EJB?
In my web application I am using google guava cache to store the User details at the EJB level.
Just wondering if there can be any implication associated with doing so.?
Where is google guava cache storing its values ?

user1455719
- 1,045
- 4
- 15
- 35
0
votes
1 answer
Block a partcular machine for a particular period of time interval
I am working on a library where I make Http call to my service and if my service machine doesn't respond back (there is a socket timeout or connect timeout), I add them to my local blockList and if machine is blocked 5 times then I don't make call…

john
- 11,311
- 40
- 131
- 251
0
votes
1 answer
Static keys in Google Guava
I want to declare a cache like this LoadingCache> in Guava. Can we have enum as keys in guava? When we create Map for enum we use EnumHasMap. Does something similar exist for Guava too?

Pankaj Kumar
- 27
- 7
0
votes
0 answers
Spring 3.2 + Guava : Get the Guava cache from cache Manager
I have a problem when trying to get back a Guava cache from a cache manager, instead I get a Spring Cache.
This is the bean in my SpringConfig file :
@Bean
public CacheManager cacheManager() {
ConcurrentMapCacheManager cacheManager = new…

yoann let
- 31
- 8
0
votes
1 answer
Cache filter on collection with Guava
I'm developing a program that performs some operations on automatas. An automata is made up of states (aka node) and transitions (aka edges) and I need to filter them to retrieve set with particular properties. This operation is easy to implement,…

Samuele Colombo
- 685
- 2
- 6
- 20
0
votes
1 answer
Restrict putting oversized object into Guava cache
Is there a way to restrict putting object which is greater than a given size.

Eranda
- 1,439
- 1
- 17
- 30