<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
Hello,</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
I'm attempting this on 2.4 and 3.4. Here's what I have:</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
    loadmodule "cachedb_local.so"<br>
    modparam("cachedb_local", "cachedb_url", "local://")</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
and then:</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
    if (condition) {</div>
<div class="elementToProof" style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
            $var(logkey) = "condition_" + $avp(user);</div>
<div style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
            if (!cache_fetch("local", "$var(logkey)", $var(devnull))) {</div>
<div style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
                    xlog("L_INFO", "log a message about a thing - fU $fU, ru $rU\n");</div>
<div style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
                    cache_store("local", "$var(logkey)", "1", 5);</div>
<div style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
            }</div>
<div class="elementToProof" style="font-family: "Lucida Console", Monaco, monospace; font-size: 10pt; color: rgb(0, 0, 0);">
    }</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
The whole idea is to have a cache entry with a TTL of 5 seconds, so that when (condition) is true, I'll only write the xlog at most every 5 seconds to avoid flooding the log. It's not working. Instead, I write the xlog every time (condition) is true, so cache_fetch()
 is failing every time even though I'm running the cache_store() two lines later.</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
The value of the cache entry itself is irrelevant (I'm storing "1"), and returning that value doesn't matter either (I'm using $var(devnull)). The important thing is the presence or absence of the cache entry to determine whether or not we've done the xlog
 in the last 5 seconds.</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
I'm hoping someone in the community can look at this and tell me what stupid mistake I've made.</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
Regards,</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
Jeff</div>
<div class="elementToProof" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
This message is subject to Fusion Connect, Inc.’s email communication policy: www.fusionconnect.com/email-policy
</body>
</html>