= Caffeine Cache Component
:doctitle: Caffeine Cache
:shortname: caffeine-cache
:artifactid: camel-caffeine
:description: Perform caching operations using Caffeine Cache.
:since: 2.20
:supportlevel: Stable
:component-header: Only producer is supported
//Manually maintained attributes
:camel-spring-boot-name: caffeine

*Since Camel {since}*

*{component-header}*

The Caffeine Cache component enables you to perform caching operations using
the simple cache from Caffeine.

Maven users will need to add the following dependency to
their `pom.xml` for this component:

[source,xml]
------------------------------------------------------------
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-caffeine</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
------------------------------------------------------------

-----------------------------
caffeine-cache://cacheName[?options]
-----------------------------

You can append query options to the URI in the following
format, `?option=value&option=#beanRef&...`

// component-configure options: START

// component-configure options: END

// component options: START
include::partial$component-configure-options.adoc[]
include::partial$component-endpoint-options.adoc[]
// component options: END

// endpoint options: START

// endpoint options: END


== Examples

You can use your cache with the following code:

[source,java]
------------------------------------------------------------
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() {
            from("direct://start")
                .to("caffeine-cache://cache?action=PUT&key=1")
                .to("caffeine-cache://cache?key=1&action=GET")
                .log("Test! ${body}")
                .to("mock:result");
        }
    };
}
------------------------------------------------------------

In this way you'll work always on the same cache in the registry.

== Check operation result

Each time you'll use an operation on the cache you'll have two different headers to check for status:

[source,java]
------------------------------------------------------------
CaffeineConstants.ACTION_HAS_RESULT
CaffeineConstants.ACTION_SUCCEEDED
------------------------------------------------------------


include::spring-boot:partial$starter.adoc[]
