Comments (5)
No, sorry. The library is intended for server-side Java 1.8+. The API and implementation take advantage of features that cannot be easily back ported (e.g. using retrolambda). I'd recommend,
- If you are on Android then prefer LruCache.
- If you want features, then use Guava's cache.
- If performance matters most, then use ConcurrentLinkedHashMap.
from caffeine.
Hi Ben, sorry for using this issue to ask a quick question:
I have been using Guava and now for small caches I just switched to Caffeine as I don't need Guava features, there are some concurrent maps I'm using for very specific caches which are growing to a finite level not a big number, mostly load almost all at start up and then just read, am I better of with ConcurrentHashMapV8
or ConcurrentLinkedHashMap
?
I mean, most of my caches are say 95%+ times read ops hence I'm using computeIfAbsent
when writing and few times computeIfPresent
for specialized writes.
from caffeine.
You're welcome to send me a private email, or create / add onto an issue. As long as you get answers I don't mind what mechanism.
I'm a little confused with your last statement about compute methods, which are Java 8 only. Or do you mean that you'd use ConcurrentHashMapV8
for a back port of that feature to Java 7?
from caffeine.
Ah, I confused you there when I mentioned the CHMv8, what I meant was that I'm already using Java 8 and AFAIK its CHM is better than older versions (v8) correct?
So what I'm trying to figure out is Java 8 CHM performance vs CLHM and Caffeine counter parts (if any present which I didn't find), for specific expiring/loading caches I'm already using Caffeine cache which I migrated from Guava's cache.
from caffeine.
Oh okay. Adding this to the Java 7 issue was confusing.
CLHM doesn't handle computations natively, so you would fallback to the looping retrials from the default method. Or you could use a decorator, but more work than you'd prefer.
CLHM is built on CHMv8 backport and Caffeine on CHM, so the raw hash table will always win. I included that as "unbounded" in my benchmark results. Note that CHM is pessimistic about computations, so I pre-screen to avoid unnecessary locking. That has a big benefit for fewer than 32-cores and is less pronounced on larger machines. Caffeine has an unbounded version that is CHM with prescreening, interface adaptions, and optional listener/writer/stats.
I think the answer you're looking for is that CHM is fine to use and really great.
from caffeine.
Related Issues (20)
- computeIfAbsent on BoundedLocalCache overwrites existing keys HOT 12
- Nested ".get()" method calls HOT 2
- Performance: Caffeine vs ConcurrentHashMap HOT 1
- [SOLVED] Library built with 3.1.6 does not run with 3.1.8 HOT 1
- explanation on hitcount HOT 6
- Help for running the test suite HOT 12
- How to refresh asynchronous cache? HOT 3
- How to Implement Batch Loading and Ensure Deduplication of Remote Loads in Caffeine HOT 1
- add support for native image - GRAALVM HOT 1
- Performance issues of Caffeine with time based expiration (vs Guava) HOT 6
- Remote cache support HOT 1
- Clarify documentation of expireAfterUpdate in Expiry HOT 1
- JCache - Cache.asMap usage HOT 3
- Property "hibernate.javax.cache.uri" is ignored in JakartaEE deployments HOT 5
- com.github.benmanes.caffeine.cache.SSLSMWA consuming very high memory. HOT 7
- Eviction function does not performed HOT 4
- java.lang.ClassCastException: java.lang.Object cannot be cast to cn.hutool.core.lang.Pair HOT 1
- Adding expiration dates different from #expireAfterWrite; saving memory (in developer situations) HOT 2
- Unnecessary fetches when using asynchronous bulk load HOT 4
- Add a `notificationExecutor`? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caffeine.