Qntrl Cache | Create, Manage, and Use Cache with Cache SDK | Cache Online Help

Cache

The Cache module lets you temporarily store key-value data that can be quickly accessed by Functions, Server Scripts, and other supported components.

Each cache entry remains available only for its configured Time-to-Live (TTL) and is automatically removed when the TTL expires.
Cache is commonly used for storing temporary values such as authentication tokens, API responses, intermediate workflow data, and shared application values.

Understanding Cache  

Cache organizes temporary data using Segments and Cache Entries.

  • Segment  

    • A Segment groups related cache entries together.

    • Example:

      • HR -- EmployeeToken, ManagerID

      • Marketing -- CampaignToken, Region

      • Finance -- ApprovalToken

  • Cache Entry  

    • A cache entry stores a single key-value pair inside a segment.

    • Each cache entry contains: Key, Value, Expiration Time (TTL)

    • When the TTL expires, the cache entry is automatically deleted.

 

Create Your First Cache and Segment

When you open the Cache module for the first time, no segments are available. Creating your first cache entry automatically creates the first segment.
  1. Log in to Qntrl.
  2. Navigate to Settings >> Advanced >> Cache.
  3. Click Create Cache.
  4. Enter the following details:
    1. Segment Name: Name of the segment in which the cache entry will be created. Since no segments exist, a new segment is created automatically.
    2. Key Name: Unique name used to identify the cache entry.
    3. Value: Value to be stored.
    4. Expiration Time (TTL): Select a predefined expiration time or specify a custom duration. The cache entry is automatically deleted when the TTL expires.
  5. Click Create


  • The first segment and the first cache entry are created together.   

  • A unique link for the segment is generated automatically and displayed at the top of the page.

  • After the first segment is created, the New Segment button becomes available at the top right of the Cache page.


Create Additional Segments

To create a segment:
  1. Click New Segment.

  2. Enter the following details:

    1. Name: Name of the segment.

    2. Description: Description of the segment.

  1. Click Create


The segment is created and listed in the left pane.  

After one or more segments are available, you can create additional cache entries under any segment.


Create Additional Cache Entries

To create additional cache entries   under a segment:

  1. Select a segment from the left pane.

  2. Click New Cache.

  3. The selected segment is automatically populated.

  4. Enter the cache details.

  5. Click Create.

The cache entry is created under the selected segment.

Cache Limits

Item

Limit

Maximum segments per organization

50

Maximum storage per segment

5 MB

Maximum total cache storage

250 MB

Maximum key length

50 characters

Maximum value size

16 KB

Minimum TTL

1 minute

Maximum TTL

48 hours



Manage Cache

Manage Segments

You can update or delete existing segments.
  1. Click the Edit icon next to the required segment in the Segment List.
  2. Update: Modify the segment details and click Save.
  3. Delete: Click the Delete icon in the top-right corner and confirm the deletion.

Manage Cache Entries

You can update or delete cache entries within a segment.

  • Select the required segment from the Segment List.

  • Click the required cache entry.

  • Update: Modify the Value or Expiration Time (TTL) and click Save.

  • Delete: Click the Delete icon in the top-right corner and confirm the deletion.


Use Cache in Server Scripts   

Cache is primarily intended for use within server-side scripts.

Functions, Server Scripts, and other supported SDK-based components can create, retrieve, update, and delete cache entries programmatically.

Cache SDK  

Use the Cache SDK to create, retrieve, update, and delete cache entries from server-side scripts.

Example:

A Function retrieves an OAuth token from an external application. Instead of requesting a new token for every execution, the token can be stored in Cache with a TTL of one hour. Subsequent executions reuse the cached token until it expires automatically.

Operation

SDK

Description

Create

QntrlCache.create(seg_id, key, value, duration)

Creates a new cache entry in the specified segment.

Retrieve

QntrlCache.of(seg_id, key)

Retrieves the value of an existing cache entry.

Update

QntrlCache.update(seg_id, key, value, duration)

Updates the value and expiration time of an existing cache entry.

Delete

QntrlCache.delete(seg_id, key)

Deletes the specified cache entry from the segment.

 

Example:

QntrlCache.create(segmentId, key, value, duration);

When executed:

  • A new cache entry is created if the key does not exist.

  • If the key already exists within the selected segment, the existing value is updated.

  • The cache entry becomes immediately available in the Cache module until its configured TTL expires.