T
tsuraan
How long do objects stick around in mod_ruby? I have a really simple
pair of files:
countersingle.rb:
-----
require 'singleton'
class Counter
include Singleton
def initialize()
@counter =3D 0
end
def get()
@counter +=3D 1
end
end
-----
and counter.rhtml:
-----
<html>
<body>
<% require 'countersingle' %>
<%=3D Counter.instance.get %>
</body>
</html>
-----
When I am refreshing the page, the count goes up. If I wait a minute
or so, the count gets reset to zero. So, I'm wondering if there's
some way to force persistence with mod_ruby, or is there a garbage
collection that happens after a minute of inactivity that will always
clear up everything that's not relevent anymore?
pair of files:
countersingle.rb:
-----
require 'singleton'
class Counter
include Singleton
def initialize()
@counter =3D 0
end
def get()
@counter +=3D 1
end
end
-----
and counter.rhtml:
-----
<html>
<body>
<% require 'countersingle' %>
<%=3D Counter.instance.get %>
</body>
</html>
-----
When I am refreshing the page, the count goes up. If I wait a minute
or so, the count gets reset to zero. So, I'm wondering if there's
some way to force persistence with mod_ruby, or is there a garbage
collection that happens after a minute of inactivity that will always
clear up everything that's not relevent anymore?