周期性事件,如何存储? [英] Recurring events, how to store them?

查看:487
本文介绍了周期性事件,如何存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现几个问题之前关于周期性事件,但我没有进入接近我的需要。我很难理解如何处理通知系统的周期性活动。

I found a few questions asked before regarding recurring events but I have not gone into one that get's close to my need. I am struggling to understand how to deal with recurring events for a notification system.

我知道目前有两个选项:

I know of two options so far:


  1. 存储具有模式的单个事件,并随时计算任何未来事件(对于像永远重复的事情等)。

  1. Store a single event that has a pattern in it and calculate on the fly any future event (for something like repeat forever, etc). Use cron patterns or even better RRULE stuff.

将所有未来事件存储为单个事件,直到某个日期为止。

Store all future events as single events until a certain date.

我的选项1的问题是,我需要我的事件来保存一些其他数据,如确认,如果我有一个重复的事件,我可能需要为每个重复事件。这变成了一个讨厌的黑客,使事情工作,我甚至不想考虑如何处理显示过去和未来的事件,有其他数据与他们相关联。

My problem with Option 1 is that I need my events to hold some other data like confirmations and if I have a repeating event I might need to hold multiple confirmations for each recurring event. This transforms into a nasty hack to make things work and I don't even want to think how to deal with displaying past and future events that have other data associated with them.

选项2是更好的,因为我可以存储所有额外的数据相关联,甚至在单个事件。问题出在处理未来的事件。首先,如果事件永远重复,我应该去多少去存储事件。如果用户想要显示未生成的未来事件,我是否只是做块和生成?

Option 2 is better since I can store all the extra data associated with each even in the single event. The problem comes with dealing with future events. First, if the event repeats forever than how much should I go for storing events. Do I just do chunks and generate on the fly if the user wants to display future event that was not already generated? This option also feels like a hack.

到目前为止,我已经读了一些关于RRULE,发现我可以使用rrule.js前端和一些其他软件包的后端。

So far I have read a bit about RRULE and found that I can use rrule.js for frontend and a few other packages for backend.

编辑1:为了更好地阐明,我不是完全设置使用完整的iCal格式标准,我想只使用RRules。但是,我可能会改变主意,因为我仍在寻找选项。

Edit 1: to better clarify, i am not completely set to use full iCal format standards and am thinking to only make use of RRules. But, I might change my mind since I am still looking for options.

如何将iCal Vevents和rrules存储在DB中?

How are iCal Vevents and rrules supposed to be stored in the DB?

推荐答案

不清楚你是否关心rrule只是一种方便的方式来表达递归的东西,或者是否要使用完整的iCalendar格式。

It is not clear whether you care about rrule only as a convenient way to express something that recurs or whether you want to use the full iCalendar format.

假设后者,RFC5545涵盖选项1:您将存储一个主VEVENT,包含基本信息,以及RRULE,每个VEVENT一个

Assuming the later, Option 1 is covered by RFC5545: you would store a "master" VEVENT, containing the base information, along with the RRULE, + one VEVENT for each instance that is an "exception" to the base event, where each exception is identified by its RECURRENCE-ID.

RFC5545没有这样的事件的任何示例,但RFC5546具有这样的事件的实例,它是基本事件的异常,其中每个异常由其RECURRENCE-相当近的 https://tools.ietf.org/html/rfc5546#section -4.4.8 (使用RDATE而不是RRULE,而不需要METHOD属性,但你得到了想法)。

RFC5545 does not have any example of such event but RFC5546 has something pretty close at https://tools.ietf.org/html/rfc5546#section-4.4.8 (using RDATE instead of RRULE and no need for the METHOD property but you get the idea).

这篇关于周期性事件,如何存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆