{"id":13436592,"url":"https://github.com/ben-manes/caffeine","last_synced_at":"2025-05-12T15:13:13.017Z","repository":{"id":24548158,"uuid":"27954927","full_name":"ben-manes/caffeine","owner":"ben-manes","description":"A high performance caching library for Java","archived":false,"fork":false,"pushed_at":"2025-05-05T00:03:05.000Z","size":108830,"stargazers_count":16593,"open_issues_count":1,"forks_count":1635,"subscribers_count":368,"default_branch":"master","last_synced_at":"2025-05-05T14:07:14.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ben-manes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-12-13T08:45:11.000Z","updated_at":"2025-05-05T11:33:26.000Z","dependencies_parsed_at":"2023-01-17T00:30:46.070Z","dependency_job_id":"ffd9b043-dcd9-4016-b300-d5694e711591","html_url":"https://github.com/ben-manes/caffeine","commit_stats":{"total_commits":2250,"total_committers":72,"mean_commits":31.25,"dds":"0.28933333333333333","last_synced_commit":"323e9020135afec093c83acb7f56e968074cfe26"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-manes%2Fcaffeine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-manes%2Fcaffeine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-manes%2Fcaffeine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ben-manes%2Fcaffeine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ben-manes","download_url":"https://codeload.github.com/ben-manes/caffeine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253763956,"owners_count":21960484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:00:50.517Z","updated_at":"2025-05-12T15:13:12.964Z","avatar_url":"https://github.com/ben-manes.png","language":"Java","readme":"[![Build Status](https://github.com/ben-manes/caffeine/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/ben-manes/caffeine/actions?query=workflow%3Abuild+branch%3Amaster)\n[![Test Count](https://gist.githubusercontent.com/ben-manes/c20eb418f0e0bd6dfe1c25beb35faae4/raw/badge.svg)](https://github.com/ben-manes/caffeine/actions?query=workflow%3Abuild+branch%3Amaster)\n[![Coverage Status](https://img.shields.io/coveralls/ben-manes/caffeine.svg?color=31c653)](https://coveralls.io/r/ben-manes/caffeine?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.ben-manes.caffeine/caffeine?color=31c653\u0026label=maven%20central)](https://central.sonatype.com/artifact/com.github.ben-manes.caffeine/caffeine)\n[![JavaDoc](https://www.javadoc.io/badge/com.github.ben-manes.caffeine/caffeine.svg?color=31c653)](http://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine)\n[![License](https://img.shields.io/:license-apache-31c653.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n[![Stack Overflow](https://img.shields.io/:stack%20overflow-caffeine-31c653.svg)](http://stackoverflow.com/questions/tagged/caffeine)\n[![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle\u0026labelColor=02303A)](https://caffeine.gradle-enterprise.cloud/scans)\n\u003ca href=\"https://github.com/ben-manes/caffeine/wiki\"\u003e\n\u003cimg align=\"right\" height=\"90px\" src=\"https://raw.githubusercontent.com/ben-manes/caffeine/master/wiki/logo.png\"\u003e\n\u003c/a\u003e\n\nCaffeine is a [high performance][benchmarks], [near optimal][efficiency] caching library. For more\ndetails, see our [user's guide][users-guide] and browse the [API docs][javadoc] for the latest\nrelease.\n\n### Cache\n\nCaffeine provides an in-memory cache using a Google Guava inspired API. The improvements draw on our\nexperience designing [Guava's cache][guava-cache] and [ConcurrentLinkedHashMap][clhm].\n\n```java\nLoadingCache\u003cKey, Graph\u003e graphs = Caffeine.newBuilder()\n    .maximumSize(10_000)\n    .expireAfterWrite(Duration.ofMinutes(5))\n    .refreshAfterWrite(Duration.ofMinutes(1))\n    .build(key -\u003e createExpensiveGraph(key));\n```\n\n#### Features at a Glance\n\nCaffeine provides flexible construction to create a cache with a combination of the following\noptional features:\n\n* [automatic loading of entries][population] into the cache, optionally asynchronously\n* [size-based eviction][size] when a maximum is exceeded based on [frequency and recency][efficiency]\n* [time-based expiration][time] of entries, measured since last access or last write\n* [asynchronously refresh][refresh] when the first stale request for an entry occurs\n* keys automatically wrapped in [weak references][reference]\n* values automatically wrapped in [weak or soft references][reference]\n* [notification][listener] of evicted (or otherwise removed) entries\n* [writes propagated][compute] to an external resource\n* accumulation of cache access [statistics][statistics]\n\nIn addition, Caffeine offers the following extensions:\n\n* [JSR-107 JCache][jsr107]\n* [Guava adapters][guava-adapter]\n* [Simulation][simulator]\n\nUse Caffeine in a community provided integration:\n\n* [Play Framework][play]: High velocity web framework\n* [Micronaut][micronaut]: A modern, full-stack framework\n* [Spring Cache][spring]: As of Spring 4.3 \u0026 Boot 1.4\n* [Coroutines][caffeine-coroutines]: Kotlin Coroutines extension\n* [Bootique][bootique]: A fast, simple Java platform\n* [Quarkus][quarkus]: Supersonic Subatomic Java\n* [Camel][camel]: Routing and mediation engine\n* [Scaffeine][scaffeine]: Scala wrapper for Caffeine\n* [ScalaCache][scala-cache]: Simple caching in Scala\n* [JHipster][jhipster]: Generate, develop, deploy\n* [Aedile][aedile]: Kotlin wrapper for Caffeine\n\nPowering infrastructure near you:\n\n* [Dropwizard][dropwizard]: Ops-friendly, high-performance, RESTful APIs\n* [Cassandra][cassandra]: Manage massive amounts of data, fast\n* [Coherence][coherence]: Mission critical in-memory data grid\n* [Accumulo][accumulo]: A sorted, distributed key/value store\n* [Kafka][kafka]: A distributed event streaming platform\n* [HBase][hbase]: A distributed, scalable, big data store\n* [Apache Solr][solr]: Blazingly fast enterprise search\n* [Infinispan][infinispan]: Distributed in-memory data grid\n* [Redisson][redisson]: Ultra-fast in-memory data grid\n* [OpenWhisk][open-whisk]: Serverless cloud platform\n* [Corfu][corfu]: A cluster consistency platform\n* [Grails][grails]: Groovy-based web framework\n* [Finagle][finagle]: Extensible RPC system\n* [Neo4j][neo4j]: Graphs for Everyone\n* [Druid][druid]: Real-time analytics\n\n### In the News\n\n* An in-depth description of Caffeine's architecture.\n  * [Design of a Modern Cache: part #1][modern-cache-1], [part #2][modern-cache-2]\n    ([slides][modern-cache-slides]) at [HighScalability][]\n* Caffeine is presented as part of research papers evaluating its novel eviction policy.\n  * [TinyLFU: A Highly Efficient Cache Admission Policy][tinylfu]\n    by Gil Einziger, Roy Friedman, Ben Manes\n  * [Adaptive Software Cache Management][adaptive-tinylfu]\n    by Gil Einziger, Ohad Eytan, Roy Friedman, Ben Manes\n  * [Lightweight Robust Size Aware Cache Management][size-tinylfu]\n    by Gil Einziger, Ohad Eytan, Roy Friedman, Ben Manes\n\n### Download\n\nDownload from [Maven Central][maven] or depend via Gradle:\n\n```gradle\nimplementation(\"com.github.ben-manes.caffeine:caffeine:3.2.0\")\n\n// Optional extensions\nimplementation(\"com.github.ben-manes.caffeine:guava:3.2.0\")\nimplementation(\"com.github.ben-manes.caffeine:jcache:3.2.0\")\n```\n\nFor Java 11 or above, use `3.x` otherwise use `2.x`.\n\nSee the [release notes][releases] for details of the changes.\n\nSnapshots of the development version are available in\n[Sonatype's snapshots repository][snapshots].\n\n[benchmarks]: https://github.com/ben-manes/caffeine/wiki/Benchmarks\n[users-guide]: https://github.com/ben-manes/caffeine/wiki\n[javadoc]: http://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine\n[guava-cache]: https://github.com/google/guava/wiki/CachesExplained\n[clhm]: https://github.com/ben-manes/concurrentlinkedhashmap\n[population]: https://github.com/ben-manes/caffeine/wiki/Population\n[size]: https://github.com/ben-manes/caffeine/wiki/Eviction#size-based\n[time]: https://github.com/ben-manes/caffeine/wiki/Eviction#time-based\n[refresh]: https://github.com/ben-manes/caffeine/wiki/Refresh\n[reference]: https://github.com/ben-manes/caffeine/wiki/Eviction#reference-based\n[listener]: https://github.com/ben-manes/caffeine/wiki/Removal\n[compute]: https://github.com/ben-manes/caffeine/wiki/Compute\n[statistics]: https://github.com/ben-manes/caffeine/wiki/Statistics\n[simulator]: https://github.com/ben-manes/caffeine/wiki/Simulator\n[guava-adapter]: https://github.com/ben-manes/caffeine/wiki/Guava\n[jsr107]: https://github.com/ben-manes/caffeine/wiki/JCache\n[maven]: https://maven-badges.herokuapp.com/maven-central/com.github.ben-manes.caffeine/caffeine\n[releases]: https://github.com/ben-manes/caffeine/releases\n[snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/github/ben-manes/caffeine/\n[efficiency]: https://github.com/ben-manes/caffeine/wiki/Efficiency\n[tinylfu]: https://dl.acm.org/doi/10.1145/3149371?cid=99659224047\n[adaptive-tinylfu]: https://dl.acm.org/doi/10.1145/3274808.3274816?cid=99659224047\n[size-tinylfu]: https://dl.acm.org/doi/10.1145/3507920?cid=99659224047\n[modern-cache-1]: http://highscalability.com/blog/2016/1/25/design-of-a-modern-cache.html\n[modern-cache-2]: http://highscalability.com/blog/2019/2/25/design-of-a-modern-cachepart-deux.html\n[modern-cache-slides]: https://docs.google.com/presentation/d/1NlDxyXsUG1qlVHMl4vsUUBQfAJ2c2NsFPNPr2qymIBs\n[HighScalability]: http://highscalability.com\n[spring]: https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#cache-store-configuration-caffeine\n[scala-cache]: https://github.com/cb372/scalacache\n[scaffeine]: https://github.com/blemale/scaffeine\n[kafka]: https://kafka.apache.org\n[hbase]: https://hbase.apache.org\n[cassandra]: http://cassandra.apache.org\n[solr]: https://solr.apache.org/\n[infinispan]: https://infinispan.org\n[neo4j]: https://github.com/neo4j/neo4j\n[finagle]: https://github.com/twitter/finagle\n[druid]: https://druid.apache.org/docs/latest/configuration/index.html#cache-configuration\n[jhipster]: https://www.jhipster.tech/\n[open-whisk]: https://openwhisk.apache.org/\n[camel]: https://github.com/apache/camel/blob/master/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc\n[coherence]: https://docs.oracle.com/en/middleware/standalone/coherence/14.1.1.2206/develop-applications/implementing-storage-and-backing-maps.html#GUID-260228C2-371A-4B91-9024-8D6514DD4B78\n[corfu]: https://github.com/CorfuDB/CorfuDB\n[micronaut]: https://docs.micronaut.io/latest/guide/index.html#caching\n[play]: https://www.playframework.com/documentation/latest/JavaCache\n[redisson]: https://github.com/redisson/redisson\n[accumulo]: https://accumulo.apache.org\n[dropwizard]: https://www.dropwizard.io\n[grails]: https://grails.org\n[quarkus]: https://quarkus.io\n[aedile]: https://github.com/sksamuel/aedile\n[bootique]: https://bootique.io/\n[caffeine-coroutines]: https://github.com/be-hase/caffeine-coroutines\n","funding_links":[],"categories":["Java","Projects","HarmonyOS","高性能数据结构和算法","Caching Libraries","其他__大数据","常用框架\\\u0026第三方库","缓存库","Memory and concurrency","项目","Technologies we used in the Microservices","Caching","\u003ca name=\"Java\"\u003e\u003c/a\u003eJava","二、核心功能库（解决具体开发问题）"],"sub_categories":["Caching","Windows Manager","FPS","网络服务_其他","缓存","4. 缓存"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-manes%2Fcaffeine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fben-manes%2Fcaffeine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fben-manes%2Fcaffeine/lists"}