[OpenSIPS-Users] Timeout value for cache_store function and timeout refreshing

Andreas Westermaier andreas.westermaier at gmx.de
Sun Mar 15 19:59:58 CET 2009


Hi,

I'm currently using 'cache_store()' to store channel limits for customers in memory to avoid the need of especially fetching it (either from radius, or from db).

Channel limit information comes in via SIP-AVP from radius on each register ('radius_www_authorize()') and on each invite ('radius_proxy_authorize()').

So after a successfull 'radius_proxy_authorize()' I currently do

if (is_avp_set("$avp(s:chanlimit)/n") && avp_check("$avp(s:chanlimit)", "gt/i:0")) {
	cache_store("local", "chanlimit_$au@$ar", "$avp(s:chanlimit)", 86400);
}

This stores the information for a whole day. But I think this could be tweaked if it would be possible to set the timeout for cache expiry to the value of the registration expiry. E.g. by using "$(hdr(Expires){s.int})" as the last parameter for 'cache_store()'.

Q1: Is there a reason why the function currently does not support the variable "$(hdr(Expires){s.int})" for the timeout value or is it just not yet implemented?

Allowing variables for timeout, the channel limit information would be available as long as the registration for a user will be valid and expires when the registration does. Of course, on each renewal of the registration also the memcache variable has to be refreshed.

Q2: Can the timeout for a memcache variable currently refreshed just by calling 'cache_store()' a second time, after the first execution and before expiration or is it necessary to firstly remove the variable from cache and insert it again for the timer to get reset?


Regards,
Andreas




More information about the Users mailing list