Clearing your cache does not delete any messages or media from your chats – they stay in the chat history, ready to re-download when you need them.
The Storage Usage page has several settings to maximize storage space – like automatically removing older media from your cache, as well as a maximum cache size on iOS.