getTectonCacheObject

Updated:
Supported Platforms:
UUX

Provides the ability to retrieve cached objects in the platform application's session cache

Details

getTectonCacheObject provides the ability to retrieved cached objects in the platform from an extension module's frontend.

Data is added to the cache using setTectonCacheObject.

Cache is automatically cleared upon logout, session timeout, or the window/browser tab closing.


Type

tecton.sources.getTectonCacheObject(key: string, moduleId: string): Promise<object>

Example

For this example, let's pretend we have two modules in an extension. One module is a simple enrollment form (we'll call it "enrollmentForm") - and the other processes the data from that enrollment form (we'll call that module "processFormData"). The moduleId parameter expects a string that combines the extension name and the module name together, separated by a period.

In our case, the "enrollmentForm" moduleId would be: MyExtension.enrollmentForm.
Similarly, the "processFormData" moduleId would be: MyExtension.processFormData.


In the javascript for the processFormData module, you would call getTectonCacheObject() and provide it the key the data was stored with, and the moduleId of the module that stored the data. In our case, the enrollmentForm module stored the data, so we will grab it and process it in the "processFormData" module.

// Inside "processFormData" module's frontend logic

tecton.sources.getTectonCacheObject('MyCacheKey', 'TestModule.enrollmentForm')

If your module is configured as a widget, then you will need to use a slightly different moduleId that is dynamically built. Instead of TestModule.enrollmentForm, you would use TestModule_enrollmentForm_widget.TestModule.enrollmentForm.

Arguments

UUX

The key under which the data is saved within the module's namespace

UUX

This should be set to the moduleId of the module that stored the item in the cache. If nothing is provided, it will default to the current module's moduleId.

Release Notes

Initial Release