FAQ
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

Search Discussions

  • Darren Duncan at Sep 4, 2010 at 7:27 pm

    Octavian Rasnita wrote:
    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.
    <snip>

    Have you tried using the FastMMap store instead? I understand this can
    automatically expire sessions. The main caveat that I'm aware of is that it is
    unreliable in a multi-thread environment. -- Darren Duncan
  • Tomas Doran at Sep 6, 2010 at 12:01 pm

    On 4 Sep 2010, at 20:27, Darren Duncan wrote:

    Have you tried using the FastMMap store instead? I understand this
    can automatically expire sessions. The main caveat that I'm aware
    of is that it is unreliable in a multi-thread environment. -- Darren
    Duncan
    s/in a multi-thread environment//. Also doesn't work if you're ever
    likely to have more than one web server, etc..

    Also, FastMMap expires one memory page (per 4k) at once, which means
    that which sessions get expired can be entirely unexpected.

    Cheers
    t0m
  • Peter Karman at Sep 5, 2010 at 1:06 am

    Octavian Rasnita wrote on 9/4/10 8:39 AM:
    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.
    can't you just use the mtime of the file to determine whether it should be deleted?

    --
    Peter Karman . http://peknet.com/ . peter@peknet.com
  • Octavian Rasnita at Sep 5, 2010 at 8:42 am
    From: "Peter Karman" <peter@peknet.com>
    Octavian Rasnita wrote on 9/4/10 8:39 AM:
    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.
    can't you just use the mtime of the file to determine whether it should be deleted?

    --
    Peter Karman . http://peknet.com/ . peter@peknet.com
    Yes, finally I've done it so.

    Thanks all.

    Octavian
  • Bernhard Graf at Sep 5, 2010 at 7:36 am

    Octavian Rasnita wrote:

    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.
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg08921.html

    HTH

    Bernhard

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedSep 4, '10 at 1:39p
activeSep 6, '10 at 12:01p
posts6
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase