[Catalyst] Deleting the expired session files?

Octavian Rasnita orasnita at gmail.com
Sat Sep 4 13:39:04 GMT 2010


Hello,

I am trying to create a script that will be executed by a cron job which will delete all the expired session files, but without success.
I use the Session::Store::File plugin.

In the configuration file I have:

'Plugin::Session' => {
expires => 20, #just for testing
cookie_name => "CAT",
cookie_expires => 0,
cookie_path => "/",
storage => '__path_to(temp,sessions)__',
cache_depth => 3,
flash_to_stash => 1,
},

I've tried using Cache::FileCache in that script and the purge() and Purge() methods but no key is deleted.

I've seen that size() method sees the size of the cache files, but the purge methods don't delete the files probably because they have "never" as the value of "_Expires_At" key.

I have also tried to use File::Find and open each cache file using Storable's thaw method but it gets the following hashrefs, and the _Expires_At keys have a "never" value indeed, although I specified to expire in 20 seconds.

Isn't the configuration of 'Plugin::Session' correct or there is a bug somewhere?

Thanks.

Here are the hashes found in those 2 files created for a session:

$VAR1 = [
          'session:5631200993ca42d282202ff3db1a629be82ef3b4',
          bless( {
                   '_Expires_At' => 'never',
                   '_Size' => undef,
                   '_Created_At' => 1283607042,
                   '_Key' => undef,
                   '_Data' => {
                                '__user_realm' => 'members',
                                '__user' => {
                                            # the user table fields here...
                                            },
                                '__created' => 1283607030,
                                '__updated' => 1283607042
                              },
                   '_Accessed_At' => 1283607042
                 }, 'Cache::Object' )
        ];

$VAR1 = [
          'expires:5631200993ca42d282202ff3db1a629be82ef3b4',
          bless( {
                   '_Expires_At' => 'never',
                   '_Size' => undef,
                   '_Created_At' => 1283607054,
                   '_Key' => undef,
                   '_Data' => 1283607074,
                   '_Accessed_At' => 1283607054
                 }, 'Cache::Object' )
        ];




Octavian




More information about the Catalyst mailing list