Thanks Andrei, <div><br></div><div>This helped a lot. I chose the first method (modified the parser to recognize cache_increment and cache_decrement methods) and now I have working atomic cached_increment and cached_decrement methods in memcached module as well :)</div>
<div><br></div><div>Abhinav<br><br><div class="gmail_quote">On Mon, Feb 22, 2010 at 4:01 PM, Andrei Dragus <span dir="ltr"><<a href="mailto:adragus@opensips.org">adragus@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi there,<br>
<div class="im"><br>
> 1. cache_fetch, cache_store and cache_remove are not exported by the<br>
> memcached module anywhere. How then are we able to use them from<br>
> opensips.cfg ?<br>
</div> There is a layer of abstractization called memcache(in the core)<br>
which can be implemented in two ways "memcached" or "localcache" (both<br>
are modules). The parser recognizes constructs such as "cache_store.."<br>
in the .cfg file and calls the appropriate methods of the<br>
abstractization layer (core), which in turn calls the method of the<br>
registered cache system(module).<br>
<br>
In other words you need to modify the parser to recognize<br>
"cache_increment" and "cache_decrement". If you choose this way you must<br>
also create appropriate methods in the localcache module or at least<br>
place warnings that they are not implemented.<br>
<br>
There is however a different approach. You can export the 2<br>
functions as you did, but you need to manually search for the server and<br>
call the library increment function. Of course the functions will look a<br>
little different. They will look like this:<br>
<br>
int cache_increment (struct sip_msg* msg, char* str1,char * str2 )<br>
{<br>
//...some code to find the appropriate handle in "servers" list<br>
// you should use fix-up functions if you know how<br>
<br>
//call the increment method.<br>
<br>
return 1; // or -1 on error<br>
}<br>
<br>
Hope it helps.<br>
<br>
--<br>
<font color="#888888">Andrei Dragus<br>
</font><div><div></div><div class="h5"><a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a><br>
</div></div></blockquote></div><br></div>