Am Dienstag, den 14.08.2007, 17:21 -0400 schrieb Benji York:
> Jeff Shell wrote:
> > We're working on something where we need to allow site visitors to
> > rate items. It's the basic star-rating thing. We want to keep a count
> > of the number of votes along with the current value.
> At work we've been contemplating an approach for use in some similar
> situations we want to address.
> In broad strokes: keep the updated value in memory, write the value to
> the database "periodically" (for whatever value of "periodically" is
> appropriate for the data).
> This should work well when the value changes often and loosing the most
> recent updates to the value isn't catastrophic.
I've used a similar approach in Zope 2. The only problem is that if you
use ZEO you end up with counters that always are slightly off. If your
use case can cope with that, then it's fine. I've used a thread in each
instance that flushed the value from memory to ensure that the flushing
is done serialized and doesn't conflict with running application
Zope3-users mailing list