[SR-Users] Managing expiration values with memcached

Alex Balashov abalashov at evaristesys.com
Wed Nov 28 11:31:53 CET 2012

According to the memcached module docs, setting $mctex(key) can be used 
to modify the expiration value of a key.

Should this be done after or before setting the key itself with 
$mct(...)?  I have tried it before and the assignment didn't work, so 
clearly the key must first exist in memcache:

   $mctex(bgn=>$avp(s:bgn)) = $sel(cfg_get.bgn_expiry);
   $mct(bgn=>$avp(s:bgn)) = $dbr(ra=>[0,0]);

Nov 28 05:23:41 diminuendo-1 /usr/local/sbin/kamailio[32089]: ERROR: 
<core> [lvalue.c:354]: setting pvar failed
Nov 28 05:23:41 diminuendo-1 /usr/local/sbin/kamailio[32089]: ERROR: 
<core> [lvalue.c:407]: assignment failed at pos: (164,37-164,69)

OK, so that makes sense.  I tried it the other way:

   $mct(bgn=>$avp(s:bgn)) = $dbr(ra=>[0,0]);
   $mctex(bgn=>$avp(s:bgn)) = $sel(cfg_get.bgn_expiry);

But when I look on my memcached server, the expiration value is not 
being modified.  It's still the default 'expire' value set in the 
memcached modparam.

I ran the memcached server with maximum verbosity and verified that no 
TOUCH command is taking place, and that the SET command for the key 
contains the default expiration value, not the one I set with $mctex(...).

So, it seems to me that the module is not committing this new expiration 
value when it is written to $mctex(...).

Is this a bug, or am I missing something?

Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

More information about the sr-users mailing list