I am creating a module on a site that allows users to reserve space, by the half hour, in roughly 10 different spaces. They can book a max of six months out from the current date. I am trying to figure out the best way to keep track of which timeslots are available for each space as the reservations are made.
My initial logic was to create custom post meta (each space is a post) so, for instance, if a space has 12 hours of availability in a day, it would have 24 post meta entries, each one structured like so:
array( 'slot_1481258220' => //the slot's starting timestamp, prefixed array( 'slotStatus' => 'open', //open or filled 'slotUser' => 123, //ID of the user that reserved the slot 'ect' => //Other meta data as needed ) );
But then I got to thinking how many pieces of data that actually is and am worried about cluttering the database. The rough math, considering 10 spaces, 12 hours per day, 7 days per week, for a solid 6 months out is over 43,000 separate meta data arrays.
A couple thoughts I had:
- I could run a cron every day that deletes any slots that are in the past and were never reserved.
- Each space's meta data would be created in one big chunk (on the first creation of the space) and then each month a cron would run to add additional meta data for the next month out, so it's always a rolling 6 months. This bloats the database even more though.
So, my questions is, am I worried about nothing? Is that many pieces of meta data not really a big deal? If it is a big deal, which I suspect, what is a better method of handling something like this?