Find the answer you are looking for

Cache Node

This node is part of the Aivo node category and allows temporary data to be stored in the cache, so that it can be retrieved later, at any point in the integration. That is, the stored data persists to a flow and remains available once the step close is reached.  

Additionally, it can be configured so that the stored values are specific to a session or shared by all sessions.  

▶ In the video we tell you the parameters to configure it:



➡Download the flow with the examples in this link.     


Below find the description of the fields that you will use in the process, as we show in the video 👇   

  1. Name: custom name given to the node and will be visible from the Studio workspace.   
  2. Key (Required):name of the key that will be stored in the cache and then used to retrieve the saved value.   
     ℹ This field supports the {{varExample}} syntax, which is used to access properties of the MSG object, for example, msg.varExample.
  3. Global: you will select false to indicate that the saved value is exclusively linked only to the specific session of a user and true if the value is required to be saved globally for all existing sessions in the instance.   
  4. Method: lists the 4 methods used for cache operations ➡GET/ SET/INCREMENT/ DELETE.  
    1. GET: used to access cached information. 

      ℹ If this value does not exist, “null” will be returned.

      ℹ If the data to be retrieved was previously saved with the Global parameter selected:

      1. True: It will be available for all sessions, as if it was a public bot. 
      2. False: it will be available in the session where the cache was recorded, as if it was  a session-specific cache.
      1. Output: name of the variable where the value retrieved from the cache will be stored, it can be an existing or new variable.   
      2. Decrypt: decrypts cached data that has been previously encrypted.   
    2. SET: it is used to store information in cache, using a key, to retrieve it later. 
      1. Input: name of the message variable, string or JSON to store in the cache.
      2. Expires: indicates the amount of time in minutes that the data will be cached. By default, data is stored for 60 minutes. The time can be at least one minute and at most 1440 minutes, which is equivalent to one day.   
      3. Encrypt: encrypts the data that you want to cache. If we encrypt the stored data, we must activate decrypt to be able to read it. That is, if you save data and place encrypt, then to recover it you must do the reverse process. The difference is that internally the data is stored in the cache in an unreadable, encrypted form.   
    3. INCREMENT: it is applied as a counter, with each execution the value is increased by 1 (one), if the variable does not exist prior to the entry of the node, it will be initialized with the value 1. In this method, the Output is completed, as in GET. 
    4. DELETE: it is implemented to delete the stored key and value (previously saved with the cache node), from a key specified in the Key field.  
      ℹ When a cached data expires or is deleted, its value becomes null.
      ℹ If the data was saved with the Global variable set to True, the node configured with the DELETE method must have the same property. The same concept applies to the case where the Global property was set to False when the data was saved. 

✅ Key data:

  1. For the correct functioning of this node,
    1. The property: msg._studio must not be deleted or changed.
    2. The agentbot user id must be stored in the msg._studio.sessionId property. ➡Any pre-existing session id configuration will continue to work without any issues.
  2. When we tell the node to take the data to be saved from a variable of the MSG object, if said data is empty, null or undefined, a warning will also be displayed in the debug console with the following structure: “Warning: {{msg property name}} is empty or undefined.“

undefined

       c. For any of the available methods to be selected in the node (GET, DELETE, INCREMENT and SET), in case the “Global” parameter setting is “False”, if the agentbot user id does not exist when the node receives the request, the warning message "The agentbot user id is not present in the msg object and global is false. Stored data may be unreachable" will be displayed in the Studio debug window. In this scenario, the variable will be saved, but in a “Global” way and the data must be retrieved in the same way (“Global“).

undefined

       d. If you use the cache node, in conjunction with an http in node, you must set the ID manually. In this case, you can do so on one of these properties in the following order of precedence:

  1. msg._studio.sessionId
  2. msg.payload.agentbot_user.id
  3. msg.payload.id
 ✏Any cache nodes already configured will continue to function normally and you will not need to perform any action on the new cache nodes you configure, even when using an http request node or any other node that rewrites the payload.
This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media. To find out more about the cookies we use, see our Privacy Policy.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference not to be tracked.