[OpenSIPS-Users] cache_fetch always returning true

Richard Robson rrobson at greenlightcrm.com
Wed Jan 4 05:17:16 EST 2017


Hi,


I'm Getting a true value back on a cahce fetch when I know the cache is 
empty and should be returning false.

  This is  causing the AVP's to be NULL and then the subsequent logic fails


this is the code


if(!cache_fetch("local","customerratelimit_$avp(accountcode)",$avp(customerratelimit))
                                         && 
cache_fetch("local","customerchannellimit_$avp(accountcode)",$avp(customerchannellimit))){
                                 ### if not cached then get details
                                 avp_db_query("select 
customerratelimit,customerchannellimit from subscriber where 
username=$avp(accountcode)", 
"$avp(customerratelimit);$avp(customerchannellimit)");

                                 xlog("rate limit    : 
$avp(customerratelimit)");
                                 xlog("channel limit : 
$avp(customerchannellimit)");
                                 ### and store them
cache_store("local","customerratelimit_$avp(accountcode)","$avp(customerratelimit)",1200);
                                 xlog("Caching: 
local,customerratelimit_$avp(accountcode),$avp(customerratelimit)");
cache_store("local","customerchannellimit_$avp(accountcode)","$avp(customerchannellimit)",1200);
                                 xlog("Caching: 
local,customerchannellimit_$avp(accountcode),$avp(customerchannellimit)");
                         }

                         xlog("rate limit    : $avp(customerratelimit)");
                         xlog("channel limit : $avp(customerchannellimit)");

There are no values in the cache at this point and taking out the ! 
gives the same result.


this is the only output from the xlog whether the if is negated or not




I'd expect the lack of cached values to cause the !false to trigger the 
db query and then store the values. I never seams to get there so I know 
there are no values.


Regards,

-- 
Richard Robson
Greenlight Support
01382 843843
support at greenlightcrm.com




More information about the Users mailing list