--- title: "Insert data to cache" url: https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/cache/insert-data-into-cache/ description: "This page describes the method to insert data into the cache in your NodeJS application with sample code snippets." last_updated: 2026-09-08T11:07:33Z service: Cloud Scale type: general related_links: - name: "Insert data to cache - API" url: /en/api/code-reference/cloud-scale/cache/insert-key-value-in-segment/#InsertKeyValueinCacheSegment - name: "Cache" url: /en/cloud-scale/help/cache/introduction --- # Insert Data in Cache > **Note:** This SDK is currently in deprecation. Migrate to [JavaScript SDK](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/cache/insert-data/) now. You can insert a [cache element](https://docs.catalyst.zoho.com/en/cloud-scale/help/cache/introduction) using the `put()` method. This enables you to insert a key-value pair in an existing cache segment in your Catalyst project. The key name and key value are of the String type and are passed as arguments to the method. You can also pass the expiry time for the cache element optionally. If you do not pass that value, the expiry time will be set to 48 hours by default. The `segment` reference used in the code snippet below is the [segment instance](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/cache/get-segment-instance) created earlier. The promise returned here will be resolved to a JSON object. ```javascript //Insert Cache by passing the key-value pair let cache = app.cache(); let segment = cache.segment(); let cachePromise = segment.put('Name', 'Linda McCartney',1); //Expiry time for cache in hours cachePromise.then((entity) => { console.log(entity); }); ``` A sample response that you will receive for each version is shown below: **Node JS** ``` { cache_name: "Last_Name", cache_value: "Smith", project_details: { project_name: "AlienCity", id: "2136000000007733" }, segment_details: { segment_name: "DataStore", id: "2136000000008572" }, expires_in: "Aug 18, 2021 06:46 PM", expiry_in_hours: "48", ttl_in_milliseconds: "172800000" } { cache_name: "Last_Name", cache_value: "Smith", project_details: { project_name: "AlienCity", id: 2136000000007733 }, segment_details: { segment_name: "DataStore", id: 2136000000008572 }, expires_in: "Aug 18, 2021 06:45 PM", expiry_in_hours: 48, ttl_in_milliseconds: 172800000 } ```