Delete a key-value pair

If a key-value pair is no longer needed, it can be permanently deleted from the cache segment. The key-value pair cannot be restored once it is deleted, but it can be recreated. The segment reference used in the code snippet below is a segment instance.

Delete using a key

You can delete a key by passing it directly as a parameter to the delete() method.

The promise returned here will be resolved to an object which is a JSON.

    
copy
//delete Cache using delete by passing the key name let cache = app.cache(); let segment = cache.segment(); let deletePromise = segment.delete('Name'); deletePromise.then((entity) => { console.log(entity); });

Last Updated 2023-09-03 01:06:41 +0530 +0530

ON THIS PAGE

RELATED LINKS

Cache