Get a Segment Instance
Note: Ensure you have installed the required package to use this SDK method.
A segment reference can be created using the following method which does not fire a server-side call. The cache reference used in the code snippet below is the component instance.
Note: If you wish to get the instance of a particular segment, then you need to pass the segment ID as the parameter. If you don’t provide any segment ID, it will refer to the default segment.
copy
// Refer a Cache segment through the Segment ID
const cache = new Cache();
const segment = cache.segment();// Since no ID is passed here, it will refer to the default segment
Last Updated 2026-07-02 14:51:41 +0530 IST
Yes
No
Send your feedback to us
Skip
Submit