Caffeine Cache

Discover more about the Caffeine Cache connector and how to use it on the Digibee Integration Platform.

Caffeine Cache uses the Caffeine library to store data in memory for quick access. It helps reduce database queries and speeds up applications by automatically managing stored data with smart expiration and eviction rules. Ideal for caching API responses, database results, and frequently used data.

Parameters

Take a look at the configuration parameters for the connector. Parameters supported by Double Braces expressions are marked with (DB).

General tab

Parameter
Description
Default value
Data type

Cache Name (DB)

Defines the name of the cache.

N/A

String

Action

Specifies the default cache action. Options: Get, Put.

N/A

String

Key (DB)

Defines the key used to identify the cache data. Used in Get and Put actions.

N/A

String

Raw Mode

When enabled, the Value parameter will be replaced by Body. Used in Put actions

False

Boolean

Body

Defined the data associated with the specified key. This field supports multiple values and is used in Put actions.

{ }

JSON

Value

Defines the data associated with the specified key. Allows only one value and is used in Put actions when Raw Mode is disabled.

N/A

String

Eviction Type

Determines how the cache evicts entries. Options: size_based, time_based.

size_based

String

Initial Capacity (when size_based is selected)

Sets the initial size for internal data structures. This doesn’t limit the cache's maximum size but helps optimize performance. If not specified, the default initial capacity is set to 16. When provided, the specified value will replace the default.

0

Integer

Maximum Size (when size_based is selected)

Defines the maximum number of entries the cache can hold, measured by quantity rather than bytes. The cache may start evicting entries before reaching this limit or briefly exceed it during eviction. Setting this value to 0 disables caching, causing entries to be removed immediately after being loaded.

0

Integer

Expire After Access Time (s) (when time_based is selected)

Defines the expiration time after the data is accessed, in seconds.

300

Integer

Expire After Write Time (s) (when time_based is selected)

Defines the expiration time after the data is written, in seconds.

300

Integer

Fail On Error

If the option is activated, the pipeline's execution with an error will be interrupted. Otherwise, the pipeline execution proceeds, but the result will show a false value for the "success" property.

False

Boolean

Optional tab

Parameter
Description
Default value
Data type

Create Cache If Not Exist

Automatically creates a new Caffeine cache if none is configured or found in the registry. When disabled, trying to access a non-existent cache will result in an error response.

True

Boolean

Do not display the result

When enabled, it doesn’t indicate if the action had a result. This is more useful for Get operations.

True

Boolean

Not showing success

When enabled, it doesn’t indicate if the action succeeded. This is more useful for Put operations.

True

Boolean

Documentation tab

Parameter
Description
Default value
Data type

Documentation

Section for documenting any necessary information about the connector configuration and business rules.

N/A

String

Usage example

In this example, we use two Caffeine Cache connectors in the flow: one at the beginning with the Put action and another at end of the flow with the Get action.

The first Caffeine Cache stores data in the cache for later use. Here’s how it is configured:

  • Cache Name: digibee

  • Action: Put

  • Key: token

  • Raw Mode: Disabled

  • Value: digibee_cache

  • Eviction Type: size_based

  • Initial Capacity: 10

  • Maximum Size: 999

When we execute only this connector, the following output confirms that the data has been successfully stored in the cache:

{
  "success": true
}

At the end of the flow, we retrieve the stored data using another Caffeine Cache connector, now configured as follows:

  • Cache Name: digibee

  • Action: Get

  • Key: token

When we execute the entire flow, we receive the following output, confirming the retrieval of the cached data:

{
  "success": true,
  "body": {
    "result": "digibee_cache"
  }
}

Last updated

Was this helpful?