Perform Operations in the OCI Cache Cluster

You can perform multiple operations against the OCI Cache cluster with the OCI Cache Adapter.

Overview

This use case provides an overview of an integration in which you configure multiple OCI Cache Adapter invoke connections to perform the following operations against the OCI Cache cluster.
Invoke Connection Data Type Operation Description
1 String Check if key exists (EXISTS) Checks if a specified key is present.
2 String Set data into cache Stores a value under a specified key.
3 String Get data from cache Retrieves the value stored for a specified key.
4 String Delete data from cache Removes a specified key and its associated value from cache.
5 List Append value(s) to list (RPUSH) Appends values to the tail end (right side) of a list.
6 List Get list length (LLEN) Returns the number of elements currently stored in a list.
7 List Delete list key Deletes a specified list and all the elements stored in that list.
8 List Get list length (LLEN) Returns the number of elements currently stored in a list.

Design Your Connections

For this use case, the following connections are created.

  1. Create and configure a REST Adapter trigger connection to use the OAuth 2.0 security policy.
  2. Create and configure an OCI Cache Adapter invoke connection:
    1. Specify the host for the OCI Cache cluster.
    2. Select Non-Sharded as the cluster mode.

Design Your Integration

  1. Create an application integration.
  2. Drag the REST Adapter into the integration canvas and configure it as follows:
    1. Set the endpoint relative response URI. For this example, /operations is specified.
    2. Select GET as the action to perform on the endpoint.
    3. Select Configure this endpoint to receive the response.
    4. Select JSON Sample as the response payload format.
    5. Specify sample JSON content:
      {
        "keyExists" : "false",
        "valueAfterSet" : "test-value",
        "listLenAfterInsert" : 1,
        "listLenAfterPop" : 0
      }
    6. Select JSON as the media-type of the response body.
  3. Drag a first OCI Cache Adapter connection into the integration canvas and define the Configure cache page to check if a specified key is present in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select String.
    3. From the Select operation list, select Check if key exists (EXISTS).


      The What do you want to call your endpoint field value is ifKeyExists. The Select data type field value is string. The Select operation value is Check if key exists (EXISTS).

  4. In the map action between the REST Adapter and OCI Cache Adapter, set a value for the target Key element. For this example, "test-key-string" is the key to check for in the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-string" in the Expression Builder.

  5. Drag a second OCI Cache Adapter connection into the integration canvas and define the Configure cache page to set a value under a specified key in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select String.
    3. From the Select operation list, select Set data into cache.


    The What do you want to call your endpoint field value is setData. The Select data type field value is string. The Select operation value is Set data into cache.

  6. In the map action, set values for the target Value and Key elements. For this example, "test-key-string" is the Key and "test-value-string" is the Value to set under the key in the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-string" in the Expression Builder.


    The Sources, Mapping canvas, and Target sections are shown. The target Value element is set to "test-value-string" in the Expression Builder.

  7. Drag a third OCI Cache Adapter connection into the integration canvas and define the Configure cache page to retrieve the value stored for the specified key in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select String.
    3. From the Select operation list, select Get data from cache.


    The What do you want to call your endpoint field value is getData. The Select data type field value is string. The Select operation value is Get data from cache.

  8. In the map action, set a value for the target Key element. For this example, "test-key-string" is the key (and its value) retrieved from the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-string" in the Expression Builder.

  9. Drag a fourth OCI Cache Adapter connection into the integration canvas and define the Configure cache page to delete data in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select String.
    3. From the Select operation list, select Delete data from cache.


    The What do you want to call your endpoint field value is deleteKey. The Select data type field value is string. The Select operation value is Get data from cache.

  10. In the map action, set a value for the target Key element. For this example, "test-key-string" is the key (and its value) deleted from the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-string" in the Expression Builder.

  11. Drag a fifth OCI Cache Adapter connection into the integration canvas and define the Configure cache page to append values to the tail end (right side) of a list in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select List.
    3. From the Select operation list, select Append value(s) to list (RPUSH).


    The What do you want to call your endpoint field value is LpushList. The Select data type field value is List. The Select operation value is Append value(s) to list (RPUSH).

  12. In the map action, set values for the following target elements to append to the end of a list in the OCI Cache cluster.
    • Set Key to "test-key-list".
    • Set (1 of 3) Values to "test-value-list-0".
    • Set (2 of 3) Values to "test-value-list-1".
    • Set (3 of 3) Values to "test-value-list-2".


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-value-list-0" in the Expression Builder.

  13. Drag a sixth OCI Cache Adapter connection into the integration canvas and define the Configure cache page to return the number of elements currently stored in a list in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select List.
    3. From the Select operation list, select Get list length (LLEN).


    The What do you want to call your endpoint field value is ListLength. The Select data type field value is List. The Select operation value is Get list length (LLEN).

  14. In the map action, set a value for the target Key element. For this example, "test-key-list" is the key of the list for which to check the length in the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-list" in the Expression Builder.

  15. Drag a seventh OCI Cache Adapter connection into the integration canvas and define the Configure cache page to delete a specified list and all the elements stored in that list in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select List.
    3. From the Select operation list, select Delete list key.


    The What do you want to call your endpoint field value is deleteList. The Select data type field value is List. The Select operation value is Delete list key.

  16. In the map action, set a value for the target Key element. For this example, "test-key-list" is the list key to delete in the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-list" in the Expression Builder.

  17. Drag an eight OCI Cache Adapter connection into the integration canvas and define the Configure cache page to return the number of elements currently stored in a list in the OCI Cache cluster.
    1. Enter a name.
    2. From the Select data type list, select List.
    3. From the Select operation list, select Get list length (LLEN).


    The What do you want to call your endpoint field value is listLengthAfterDelete. The Select data type field value is List. The Select operation value is Get list length (LLEN).

  18. In the map action, set a value for the target Key element. For this example, "test-key-list" is the key of the list for which to check the length in the OCI Cache cluster.


    The Sources, Mapping canvas, and Target sections are shown. The target Key element is set to "test-key-list" in the Expression Builder.

  19. In the map action at the end of the integration, map the following source elements and target elements.


    The Sources, Mapping canvas, and Target sections are shown.

Activate and Run the Integration

  1. Assign a business identifier to the integration, then activate it.
  2. From the Actions Actions icon list for the integration, select Run.
  3. Click Run.
  4. Expand the activity stream to view key milestones. Several milestones are described below.
  5. View the key being provided to the OCI Cache cluster (test-key-string).


    The activity stream is expanded to show the Message received by the Invoke getData milestone.

  6. View the value and key in the response message (test-value-string and test-key-string).


    The activity stream is expanded to show the Message processed by the Invoke getData milestone.

  7. View the list key received (test-key-list).


    The activity stream is expanded to show the Message received by the Invoke ListLength milestone.

  8. View the count of elements in the list that is returned.


    The activity stream is expanded to show the Message processed by the Invoke ListLength milestone.

  9. After the list is deleted, the count returned is zero.


    The activity stream is expanded to show the Message processed by the Invoke listLengthAfterDelete milestone.