--- title: "Update Data in Cache" url: https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/cache/update-data-in-cache/ description: "This page describes the method to update data in the cache in your Java application with sample code snippets." last_updated: 2026-09-08T11:07:33Z service: Cloud Scale type: general related_links: - name: "Update Data in Cache - API" url: /en/api/code-reference/cloud-scale/cache/update-key-value/#UpdateKey-ValuePair - name: "Cache" url: /en/cloud-scale/help/cache/introduction --- # Update 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/update-cache/) now. You can update the key-value pair in a cache segment using the `update()` method. You must pass the key name and key-value which are of the String type as arguments. If the values aren't present, they will be inserted into the cache segment. The promise returned here will be resolved to a JSON object. You can also optionally pass the expiry time parameter. If you don't assign a value for that, 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. ```javascript //Update cache by passing the key-value pair let cache = app.cache(); let segment = cache.segment(); let cachePromise = segment.update('Name', 'Micheal Greene'); 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: "Brown", 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: "47", ttl_in_milliseconds: "172596000" } { cache_name: "Last_Name", cache_value: "Brown", 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: 47, ttl_in_milliseconds: 172511000 } ```