[SR-Users] Managing expiration values with memcached

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


All right, I figured it out.  It works fine as long as the PV processing 
function for the expiration values regards the assigned value to being 
of an integer type:

I would think this would pass the test:

    bgn.expiry = 10600 descr "...";

However, it just gets ignored and not assigned.  When I do this, it 
works just fine, though:

    $mctex(bgn=>$avp(s:bgn)) = $(sel(bgn.expiry){s.int});

On 11/28/2012 05:41 AM, Alex Balashov wrote:

> OK, so the problem seems to be with binding the values of cfg_get
> variables specifically.
>
> It works fine if I use static values:
>
>     $mctex(bgn=>$avp(s:bgn)) = 10600;
>
> Or even other PVs:
>
>     $var(x) = 10600;
>     $mctex(bgn=>$avp(s:bgn)) = $var(x);
>
> It really does seem to be a problem with the cfg_get variables, because
> a transitive approach doesn't work, either:
>
>     $var(x) = $sel(cfg_get.bgn_expiry);
>     $mctex(bgn=>$avp(s:bgn)) = $var(x);
>
> On 11/28/2012 05:31 AM, Alex Balashov wrote:
>
>> 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