How To Install caffeine on Fedora 34

caffeine is High performance, near optimal caching library based on Java 8

Introduction

In this tutorial we learn how to install caffeine on Fedora 34.

What is caffeine

A Cache is similar to ConcurrentMap, but not quite the same. The most fundamental difference is that a ConcurrentMap persists all elements that are added to it until they are explicitly removed. A Cache on the other hand is generally configured to evict entries automatically, in order to constrain its memory footprint. In some cases a LoadingCache or AsyncLoadingCache can be useful even if it doesn’t evict entries, due to its automatic cache loading. Caffeine provide flexible construction to create a cache with a combination of the following features automatic loading of entries into the cache, optionally asynchronously size-based eviction when a maximum is exceeded based on frequency and recency time-based expiration of entries, measured since last access or last write asynchronously refresh when the first stale request for an entry occurs keys automatically wrapped in weak references values automatically wrapped in weak or soft references notification of evicted (or otherwise removed) entries writes propagated to an external resource accumulation of cache access statistics

We can use yum or dnf to install caffeine on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install caffeine.

Install caffeine on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install caffeine using dnf by running the following command:

sudo dnf -y install caffeine

Install caffeine on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install caffeine using yum by running the following command:

sudo yum -y install caffeine

How To Uninstall caffeine on Fedora 34

To uninstall only the caffeine package we can use the following command:

sudo dnf remove caffeine

caffeine Package Contents on Fedora 34

/usr/share/doc/caffeine
/usr/share/doc/caffeine/README.md
/usr/share/java/caffeine
/usr/share/java/caffeine/caffeine.jar
/usr/share/licenses/caffeine
/usr/share/licenses/caffeine/LICENSE
/usr/share/maven-metadata/caffeine-caffeine.xml
/usr/share/maven-poms/caffeine
/usr/share/maven-poms/caffeine/caffeine.pom

References

Summary

In this tutorial we learn how to install caffeine on Fedora 34 using yum and dnf.