How to get rid of from overbooking car rental website [closed]

Guys found the solution at **stackoverflow**:

You can use set_transient function after someone booked a car. I assume a car is post type and all post have a unique ID. So after a car is booked you create a transient which expires after one hour. Check Documentation. Your code might have the next logic.

set_transient( $post_id . '_car_is_booked', true, HOUR_IN_SECONDS );

You set transient for HOUR_IN_SECONDS it is a special WordPress variable and after one hour it will be removed from the database automatically. So to find our is this car is booked or not you can use function get_transient get_transient Docs.

// return false if option does not exists 
get_transient( $post_id . '_car_is_booked' );

And if transient for specific post ID exists it means the car is booked less then one hour ago.