Hi~
On Sep 11, 2006, at 5:24 AM, Bill W. wrote:
as an alternative to PStore and ActiveRecord session stores. I
really don’t
know much of anything about session management mechanisms and I have a
feeling you’re telling me something I need to understand. Could
you say
more about this please?
I think there is some confusion n the wiki. There is a DRb session
container that you can use that comes with rails. BackgrounDRb is a
rails plugin that I wrote for running long background tasks with hook
for ajax progress bars or status updates in the browser. BackgrounDRb
has nothing to do with sessions and will not work as a session
container. For session containers here are your main options:
Pstore: filesystm storage, slowest of all the session containers.
ActiveRecord session store: stores sessions in a database table. Fast
DRb session store: similar speed to ActiveRecord store but not as
robust and has less features. I have never used this one for
production and i dont think that many people use this one.
Memcached: fastest session container but requires running extra
daemons. Use this if you need to scale to the moon.
Stefan Kaeys Mysql session store: Faster then AR session store
because its direct sql access. worth lookin at.
Out of all these the one I usualy use most is ActiveRecord store. Its
very easy to set up and is pretty fast. This is the one I recommend.
You can always change it later if it becomes necessary but it will
handle all but the hugest sites fast.
Backgroundrb is
a lightweight alternative that combines the session store mechanism
with
cron-like worker processes. I misunderstood?
Backgroundrb does have cron like workers. And you can manage them
from your rails app. But it is not a session container. So I think it
can work for what you want to do.
The main issue I’m trying to get my arms around is how to get at
the data
the user entered during their session so it can be deleted. Is it
possible
for the cron job to access the application data? Do you know of
any online
examples of how that would be done? The following happens when the
user
explicitly logs out of the app.
Are you marking your records with some kind of identifier so you can
delete everything someone created? Or how will you know which objects
to delete when you clean up after them?
emrec.destroy # delete all the db records the visitor has created
Bill
If you store your sessions in the ActiveRecord session container you
can query it like any other db table. So you can do a query for all
the sessions that have no activity for 15 minutes or however long you
want. Then use that info to delete the correct records.
BackgrounDRb can be used to do what you want. But you may want to
keep it simple and use script/runner and cron.
-Ezra