Coder Social home page Coder Social logo

java 1.7 support about caffeine HOT 5 CLOSED

ben-manes avatar ben-manes commented on June 18, 2024
java 1.7 support

from caffeine.

Comments (5)

ben-manes avatar ben-manes commented on June 18, 2024

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,

from caffeine.

guidomedina avatar guidomedina commented on June 18, 2024

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.

ben-manes avatar ben-manes commented on June 18, 2024

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.

guidomedina avatar guidomedina commented on June 18, 2024

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.

ben-manes avatar ben-manes commented on June 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.