{"id":16828492,"url":"https://github.com/pjfanning/jackson-caffeine-cache","last_synced_at":"2025-07-09T16:05:47.546Z","repository":{"id":39741311,"uuid":"208495131","full_name":"pjfanning/jackson-caffeine-cache","owner":"pjfanning","description":"A Caffeine based type cache for Jackson","archived":false,"fork":false,"pushed_at":"2025-03-08T21:44:22.000Z","size":371,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T21:52:30.190Z","etag":null,"topics":["caffeine","caffeine-cache","jackson"],"latest_commit_sha":null,"homepage":null,"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/pjfanning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"pjfanning"}},"created_at":"2019-09-14T19:48:12.000Z","updated_at":"2025-03-08T21:44:27.000Z","dependencies_parsed_at":"2024-03-13T20:56:31.554Z","dependency_job_id":"52eef5fd-0d62-43db-ae0e-5046f8a41ee0","html_url":"https://github.com/pjfanning/jackson-caffeine-cache","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjfanning%2Fjackson-caffeine-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjfanning%2Fjackson-caffeine-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjfanning%2Fjackson-caffeine-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjfanning%2Fjackson-caffeine-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjfanning","download_url":"https://codeload.github.com/pjfanning/jackson-caffeine-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122825,"owners_count":20564382,"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":["caffeine","caffeine-cache","jackson"],"created_at":"2024-10-13T11:26:55.444Z","updated_at":"2025-03-23T15:31:32.742Z","avatar_url":"https://github.com/pjfanning.png","language":"Java","funding_links":["https://github.com/sponsors/pjfanning"],"categories":[],"sub_categories":[],"readme":"# jackson-caffeine-cache\n\n[![Build Status](https://travis-ci.com/pjfanning/jackson-caffeine-cache.svg?branch=master)](https://travis-ci.com/pjfanning/jackson-caffeine-cache)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pjfanning/jackson-caffeine-cache/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pjfanning/jackson-caffeine-cache)\n\nA Caffeine based type cache for Jackson. This is built with Caffeine 2.9 in order to support Java 8. If you are using Java 11 or above, it is recommended that you have your build pick up the latest Cafferine 3.x jar. It is expected that this will work ok with jackson-caffeine-cache.\n\nThe built-in type cache ([LRUMap](https://github.com/FasterXML/jackson-databind/blob/2.17/src/main/java/com/fasterxml/jackson/databind/util/LRUMap.java))\nin Jackson has synchronization that might cause performance issues if you have a lot of types in the cache (see [issue](https://github.com/FasterXML/jackson-module-scala/issues/428)). In older versions of Jackson, LRUMap emptied the cache when it filled up. The Caffeine cache will remove the oldest entries (as does LRUMap since the Jackson 2.14.0 release).\n\nTo use an LRUMap with larger max size:\n\n        LRUMap\u003cObject, JavaType\u003e cache = new LRUMap(4, 1000);\n        TypeFactory tf = TypeFactory.defaultInstance().withCache(cache);\n        ObjectMapper mapper = new ObjectMapper();\n        mapper.setTypeFactory(tf);\n        //or ObjectMapper mapper = JsonMapper.builder().typeFactory(tf).build();\n\nTo use this [Caffeine](https://github.com/ben-manes/caffeine) based cache:\n\n        CaffeineLookupCache\u003cObject, JavaType\u003e cache = new CaffeineLookupCache(1000);\n        TypeFactory tf = TypeFactory.defaultInstance().withCache(cache);\n        ObjectMapper mapper = new ObjectMapper();\n        mapper.setTypeFactory(tf);\n        //or ObjectMapper mapper = JsonMapper.builder().typeFactory(tf).build();\n        \n# Jackson 2.11\n\njackson-caffeine-cache 1.0.1 is the right version to use with Jackson 2.11.\n        \n# Jackson 2.12 and above\n \njackson-caffeine-cache 1.1.0 was refactored to take advantage of a change in Jackson 2.12.0. LRUMap now implements a LookupCache interface. This makes it easier to create custom cache implementations.\n\nCaffeineLookupCache will still work with TypeFactory, as above. Some Jackson APIs still require an LRUMap. If you want to use a Caffeine-based cache instead of a LRUMap, there is a new CaffeineLRUMap.\n\n# Jackson-Module-Scala\n\nAfter the v2.12.2 release, it is possible to replace the default LRUMap descriptorCache.\n\n        import tools.jackson.databind.type.ClassKey\n        import tools.jackson.module.scala.introspect._\n        \n        val cache = new CaffeineLookupCache[ClassKey, BeanDescriptor](1000)\n        ScalaAnnotationIntrospector.setDescriptorCache(cache)\n        //after v2.13.1 is released, the method is deprecated and replaced by \n        ScalaAnnotationIntrospectorModule.setDescriptorCache(cache)\n        \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjfanning%2Fjackson-caffeine-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjfanning%2Fjackson-caffeine-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjfanning%2Fjackson-caffeine-cache/lists"}