I need to generate some files that I only need for the duration of a
user’s session.
If I create these files in the Rails “tmp” directory, is there any
automagic process that will periodically clean out the “tmp” directory,
or is that something that I would have to manage myself?
I need to generate some files that I only need for the duration of a
user’s session.
If I create these files in the Rails “tmp” directory, is there any
automagic process that will periodically clean out the “tmp” directory,
or is that something that I would have to manage myself?
rake tmp:cache:clear # Clears all files and directories
in tmp/cache
rake tmp:clear # Clear session, cache, and socket
files from tmp/
rake tmp:create # Creates tmp directories for
sessions, cache, and sockets
rake tmp:sessions:clear # Clears all files in tmp/sessions
rake tmp:sockets:clear # Clears all files in tmp/sockets
Add one or more of those to your crontab file and that should do it for
you…
I need to generate some files that I only need for the duration of a
user’s session.
If I create these files in the Rails “tmp” directory, is there any
automagic process that will periodically clean out the “tmp” directory,
or is that something that I would have to manage myself?
rake tmp:cache:clear # Clears all files and directories
in tmp/cache
rake tmp:clear # Clear session, cache, and socket
files from tmp/
rake tmp:create # Creates tmp directories for
sessions, cache, and sockets
rake tmp:sessions:clear # Clears all files in tmp/sessions
rake tmp:sockets:clear # Clears all files in tmp/sockets
Add one or more of those to your crontab file and that should do it for
you…
-philip
Keep in mind, clearing sessions will kill all active sessions to. I
don’t recommend that. You could create a model called:
PeriodicNightly with something like this in it:
def self.run
CGI::Session::ActiveRecordStore::Session.
destroy_all( [‘updated_at <?’, 48.hours.ago] )
end