MCPcopy Index your code
hub / github.com/ben-manes/caffeine

github.com/ben-manes/caffeine @v3.2.4 sqlite

repository ↗ · DeepWiki ↗ · release v3.2.4 ↗
9,949 symbols 62,745 edges 661 files 1,913 documented · 19%
README

Build Status Test Count Coverage Status Maven Central JavaDoc License Revved up by Develocity

Caffeine is a high performance, near optimal caching library. For more details, see our user's guide and browse the API docs for the latest release.

Cache

Caffeine provides an in-memory cache using a Google Guava inspired API. The improvements draw on our experience designing Guava's cache and ConcurrentLinkedHashMap.

LoadingCache<Key, Graph> graphs = Caffeine.newBuilder()
    .maximumSize(10_000)
    .expireAfterWrite(Duration.ofMinutes(5))
    .refreshAfterWrite(Duration.ofMinutes(1))
    .build(key -> createExpensiveGraph(key));

Features at a Glance

Caffeine provides flexible construction to create a cache with a combination of the following optional features:

In addition, Caffeine offers the following extensions:

Use Caffeine in a community provided integration:

Powering infrastructure near you:

  • Dropwizard: Ops-friendly, high-performance, RESTful APIs
  • Cassandra: Manage massive amounts of data, fast
  • Coherence: Mission critical in-memory data grid
  • Accumulo: A sorted, distributed key/value store
  • Kafka: A distributed event streaming platform
  • HBase: A distributed, scalable, big data store
  • Apache Solr: Blazingly fast enterprise search
  • Infinispan: Distributed in-memory data grid
  • Redisson: Ultra-fast in-memory data grid
  • OpenWhisk: Serverless cloud platform
  • Corfu: A cluster consistency platform
  • Grails: Groovy-based web framework
  • Finagle: Extensible RPC system
  • Neo4j: Graphs for Everyone
  • Druid: Real-time analytics

In the News

Download

Download from Maven Central or depend via Gradle:

implementation("com.github.ben-manes.caffeine:caffeine:3.2.3")

// Optional extensions
implementation("com.github.ben-manes.caffeine:guava:3.2.3")
implementation("com.github.ben-manes.caffeine:jcache:3.2.3")

For Java 11 or above, use 3.x otherwise use 2.x.

See the release notes for details of the changes.

Snapshots of the development version are available in Sonatype's snapshots repository.

Extension points exported contracts — how you extend this code

ConfigSource (Interface)
A provider for the external configuration. @author ben.manes@gmail.com (Ben Manes) [35 implementers]
jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/ConfigSource.java
Action (Interface)
Like Runnable, but with the freedom to throw anything. junit folks had the same idea: http://junit.org/junit5/docs/snaps [37 …
caffeine/src/jsr166Test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java
Policy (Interface)
A cache that implements a page replacement policy. @author ben.manes@gmail.com (Ben Manes) [16 implementers]
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Policy.java
Queries (Interface)
@author ben.manes@gmail.com (Ben Manes)
examples/hibernate/src/main/java/com/github/benmanes/caffeine/examples/hibernate/Queries.java
FactoryCreator (Interface)
An object capable of providing factories that produce an instance for a given class name. @author ben.manes@gmail.com ( [3 …
jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/FactoryCreator.java
Scheduler (Interface)
A scheduler that submits a task to an executor after a given delay. @author ben.manes@gmail.com (Ben Manes) [6 implementers]
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java
HillClimber (Interface)
A hill climbing algorithm to tune the admission window size. @author ben.manes@gmail.com (Ben Manes) [7 implementers]
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimber.java
Copier (Interface)
An object is copied when the cache is configured with storeByValue to guard against mutations of the key or [2 implementers]
jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/Copier.java

Core symbols most depended-on inside this repo

get
called by 1349
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java
asMap
called by 1133
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java
put
called by 1060
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java
size
called by 799
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Buffer.java
remove
called by 637
caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/BasicCache.java
of
called by 547
caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/CacheStats.java
newBuilder
called by 546
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java
stats
called by 410
caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java

Shape

Method 8,838
Class 938
Enum 104
Interface 69

Languages

Java100%

Modules by API surface

caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java343 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsMapTest.java309 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java289 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncAsMapTest.java286 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/ExpireAfterVarTest.java193 symbols
caffeine/src/jsr166Test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java166 symbols
caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java159 symbols
caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java157 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineTest.java152 symbols
caffeine/src/eclipseTest/java/com/github/benmanes/caffeine/eclipse/mutable/MapIterableTestCase.java144 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/LinkedDequeTest.java127 symbols
caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java116 symbols

For agents

$ claude mcp add caffeine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact