|Just another Perl shrine|
precalculating event dates vs.recalculating them.by schweini (Friar)
|on Jun 22, 2008 at 20:21 UTC||Need Help??|
schweini has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, long time, no ask!
I've been tasked with the implementation of a event-based website, a bit like upcoming.com, only that we have to support recurring events, which, as many might know, are a royal PITA to handle.
My plan was to precalculate events, and insert one entry into the DB for each ocurrence of the event, in order to make the retrieval of the data (which will hopefully be very frequent) quick and simple. My partners insist that this is not elegant, and that events should be stored as they were created with the recurrence-information stored a la iCalendar, and that each time we show a calendar or a list of events, we re-calculate whether a given event applies to the current time-span or not. This seems to be the approach that most webcalender-software solutions take, but this seems like a daunting waste of computational resources to me.
We cant be the first ones to ponder this problem, so does anyone have any hints or caveats of either approach (precalculating recurring events vs. storing only the recurrence-information) on hand?
P.S.: does anyone klnow of any accepted feed-format for event-information? I could only find iCalendar, and maybe RSS-with-embedded-xCal information, which sturck me as odd.