Welcome to the forum Bullwinkle
All dashcams have such a button, it is called the emergency or event button.
BUT ! it is very different how it behave when you press that button,
The best performing cameras in this regard ( IMO ) are the street guardian cameras, they deal in segments and two of them, and so if you use 3 minute segment size you will get 6 minutes saved.
If the current segment are less than 50% done, it will be locked + the previous one. ( so you will have 4.5 minutes before and 1.5 minutes after,,,, assuming 3 min segment size are used )
If the current segment are over 50% done, the current segment will be locked plus the following one. ( so you will have 1.5 minutes before and 4.5 minutes after, again assuming 3 minute segment size and worst case )
Other might save the current segment only, which is bad if you are pressing the button right at the start of a new segment or right near the end.
Others will have a memory buffer ( often 20 seconds ) and then lock 30 seconds after that for a total of 50 seconds.
Now the cameras that deal in segments you can change using another segment size, i think at least 5 minutes are possible, maybe even 10 minutes, but really you should not use that big segment sizes.
What you should do is buy a plenty large memory card, which today mean at least 128 GB but if the camera support it 256GB would be even better, a 128 GB card in a 1080p system with 2 cameras should at least have room for 8 hours of recording, so you will have to drive for a long timer after your "event" to loose the footage you might want to save that are not within the locked file / files.
If you are driving really far, and want to be absolutely sure you get everything, or everything in locked files + what might be around them, you should stop every X - XX hours and copy your footage to a laptop hard drive.
By using the camera in your chosen configuration it will be easy to calculate how much memory space the camera need for 1 hour of recording, and then depending on memory card size calculate how many hours you can store before recycling begin.
Just make sure to have a fast card reader on a fast USB port, cuz if either of these are slow, copying many GB of recording will take some time.
So get your system in good time, familiarize yourself with it, and what it can do for record duration with your memory card, then you should be good to go.
A really slow card reader or USB port and you can only copy files at 20 MB/ second, if you have a fast card reader on a fast USB port ( USB 3.0 or better ) you can get the full read speed of your memory card which are often around 90 MB/second.
Remember to copy files off the memory card, do not move the files to another storage media
A expensive way to do it could also be using several memory cards and just swap when they are full and so have everything saved, but if you are going to drive across a big chunk of your not pea sized country, then thats probably a unsustainable solution.
But many of us addicts we have one or more spare cards in the car just in case,,,, CUZ after a decade of dashcam use we get like withdrawal symptoms if there are nothing recording in our car.