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.

The segment_service reference used in the code snippet below is the segment instance created earlier.

Delete using a Key

You can delete a key-value pair by passing the key name directly as a parameter to the delete() method.

    
copy
#Delete a key-value pair cache_service = app.cache() segment_service = cache_service.segment() segment_service.delete('Name')

ON THIS PAGE

RELATED LINKS

Cache