DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Cache.getIfPresent with valueLoader #1515

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi there,

I'd propose an additional <T> T getIfPresent(Object key, Callable<T> 
valueloader) method that behaves just like getIfPresent(Object key) and 
immidiately returns the value (or null) but will load the value in the 
background.

As Cache.get(Object, Callable<T>) blocks until the value has been loaded the 
proposed Cache.getIfPresent(Object, Callable<T>) method would not be blocking. 
This comes handy if the valueloader does some heavy lifting and should only run 
once per key.

Thanks in advance,
Arman

Original issue reported on code.google.com by arman.va...@gmail.com on 27 Aug 2013 at 9:06

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08