[Zope] Volatile Properties in ZClasses?

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Wed, 3 Nov 1999 12:39:41 +1100 (EST)


On Tue, 2 Nov 1999, Tom Schwaller wrote:

> Updating the "hits"-property when the banner 
> is loaded, has the effect, that the
> Banner-Object is backuped by the Zope magic,
> which is quite annyoing when having a high-traffic 
> site. So, how can one generate volatile properties,
> which do not get backuped (I tried it whith _hits,
> but ZClasses do not likte them ;-) --> Zope Error).
> 
> Is there a reason for not allowing _Variables in ZClasses
> and how does one solve the Problem in this case
> (seems like a generael problem)

_v_name volatile variables wouldn't work in this case anyway, as they
are not shared between threads.

What you want to do cannot be done with just ZClasses. Possible options
are:
    Create an external method or product that has a global dictionary
    to store the results in. Note that code like '_hit{page} = _hit{page} + 1'
    is not atomic and it is theoretically possible for you to drop hits.

    Do it with a backend RDBMS via ZSQL

Yes, Zope really needs volatile variables that are shared between threads 
(and ZEO processes).

 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen