Class level variables in Mongrel


#1

I’m trying to use a class level variable @@count as a counter between
requests to the server. So for example I initialize it @@count = 0 at
the top of the class and in a method I have @@count = @@count+1. It
seems though that @@count is begin reinitialized back to 0 each time the
controller is called. Is there something that I’m missing here? I’m
running under mongrel on Linux.


#2

Kris Kohlstedt wrote:

I’m trying to use a class level variable @@count as a counter between
requests to the server. So for example I initialize it @@count = 0 at
the top of the class and in a method I have @@count = @@count+1. It
seems though that @@count is begin reinitialized back to 0 each time the
controller is called. Is there something that I’m missing here? I’m
running under mongrel on Linux.

Well for every request to the server you would get a new class variable
:slight_smile: