--- title: "Update Data in Cache" url: https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/cache/update-cache/ description: "This page describes the method to perform operations in the Cache component." last_updated: 2026-09-09T10:45:38Z service: CloudScale type: general related_links: - name: "Catalyst CloudScale" url: /en/cloud-scale/ - name: "Cache Help Documentation" url: /en/cloud-scale/help/cache/introduction/ - name: "Java SDK Documentation" url: /en/sdk/java/v1/cloud-scale/cache/update-data-in-cache/ - name: "Python SDK Documentation" url: /en/sdk/python/v1/cloud-scale/cache/update-data-in-cache/ - name: "REST API Documentation" url: /en/api/code-reference/cloud-scale/cache/insert-key-value-in-segment/#InsertKeyValueinCacheSegment repository: name: "Repository" url: https://github.com/catalystbyzoho/zcatalyst-sdk-js --- # Update Data in Cache > **Note:** Ensure you have installed the [required package](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/cache/overview/#prerequisites) to use this SDK method. You can update the key-value pair in a cache segment using the `update()` SDK 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/javascript/v1/cloudscale/cache/get-segment-instance/). ```javascript //Update cache by passing the key-value pair const cache = new Cache(); const segment = cache.segment(); const entity = await segment.update('Name', 'Micheal Greene'); console.log(entity); ``` #### Example of Expected Response A sample response that you will receive for each version is shown below. ```json { "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" } ```