Stuart 'Zen' Bishop wrote:
_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
That's what I do right now in my own setup, but for such a simple situtation I would prefer a pure Zope solution... :-) Remakr: I did some benchmarks (with "ab" from apache) to see how ZClasses and Zope/MYSQL pageviews compare (our newsflash in an old version and in a new ZClass version (some kmnn-ZClasse hack) to be precise, but both with the same content) and the Zope-Version was 3 times faster, which persuaded me to use the Zope ODB (and not a classical SQL-Database) in medium sized object-collections projects.
Yes, Zope really needs volatile variables that are shared between threads (and ZEO processes).
would be really nice... Maybe writing a small Python-class with _v_variables and deriving a Banner-ZClass from it would give a nice example. Playing with ZPickle could also be nice to here...... -- Tom