<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I&#8217;m also interested in this functionality, would you like to share
it? </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Maybe Andrei will like to apply your patches to the trunk </span><span
style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
devel-bounces@lists.opensips.org [mailto:devel-bounces@lists.opensips.org] <b>On
Behalf Of </b>Abhinav Jha<br>
<b>Subject:</b> Re: [OpenSIPS-Devel] [Memcached module] Adding
cache_increment/cache_decrement methods<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thanks Andrei,&nbsp;<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>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 :)<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'>Abhinav<o:p></o:p></p>

<div>

<p class=MsoNormal>On Mon, Feb 22, 2010 at 4:01 PM, Andrei Dragus &lt;<a
href="mailto:adragus@opensips.org">adragus@opensips.org</a>&gt; wrote:<o:p></o:p></p>

<p class=MsoNormal>Hi there,<o:p></o:p></p>

<div>

<p class=MsoNormal><br>
&gt; 1. cache_fetch, cache_store and cache_remove are not exported by the<br>
&gt; memcached module anywhere. How then are we able to use them from<br>
&gt; opensips.cfg ?<o:p></o:p></p>

</div>

<p class=MsoNormal>&nbsp; &nbsp; There is a layer of abstractization called
memcache(in the core)<br>
which can be implemented in two ways &quot;memcached&quot; or
&quot;localcache&quot; (both<br>
are modules). The parser recognizes constructs such as
&quot;cache_store..&quot;<br>
in the .cfg file and &nbsp;calls the appropriate &nbsp;methods &nbsp;of the<br>
abstractization layer (core), which in turn calls the method of the<br>
registered cache system(module).<br>
<br>
&nbsp; &nbsp;In other words &nbsp;you need to modify the parser to recognize<br>
&quot;cache_increment&quot; and &quot;cache_decrement&quot;. 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>
&nbsp; &nbsp;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>
&nbsp; &nbsp;//...some code to find the appropriate handle in
&quot;servers&quot; list<br>
&nbsp; &nbsp;// you should use fix-up functions if you know how<br>
<br>
&nbsp; &nbsp;//call the increment &nbsp;method.<br>
<br>
&nbsp; &nbsp;return 1; // or -1 on error<br>
}<br>
<br>
Hope it helps.<br>
<br>
--<br>
<span style='color:#888888'>Andrei Dragus</span><o:p></o:p></p>

<div>

<div>

<p class=MsoNormal><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><o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=MsoNormal><br>
This mail was received via Mail-SeCure System.<o:p></o:p></p>

</div>

</div>

<br><br>
This mail was sent via Mail-SeCure System.<br>
</body>

</html>