[OpenSIPS-Devel] [Memcached module] Adding cache_increment/cache_decrement methods
Alex Massover
alex at jajah.com
Wed Feb 24 10:01:25 CET 2010
I'm also interested in this functionality, would you like to share it? :)
Maybe Andrei will like to apply your patches to the trunk :)
From: devel-bounces at lists.opensips.org [mailto:devel-bounces at lists.opensips.org] On Behalf Of Abhinav Jha
Subject: Re: [OpenSIPS-Devel] [Memcached module] Adding cache_increment/cache_decrement methods
Thanks Andrei,
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 :)
Abhinav
On Mon, Feb 22, 2010 at 4:01 PM, Andrei Dragus <adragus at opensips.org<mailto:adragus at opensips.org>> wrote:
Hi there,
> 1. cache_fetch, cache_store and cache_remove are not exported by the
> memcached module anywhere. How then are we able to use them from
> opensips.cfg ?
There is a layer of abstractization called memcache(in the core)
which can be implemented in two ways "memcached" or "localcache" (both
are modules). The parser recognizes constructs such as "cache_store.."
in the .cfg file and calls the appropriate methods of the
abstractization layer (core), which in turn calls the method of the
registered cache system(module).
In other words you need to modify the parser to recognize
"cache_increment" and "cache_decrement". If you choose this way you must
also create appropriate methods in the localcache module or at least
place warnings that they are not implemented.
There is however a different approach. You can export the 2
functions as you did, but you need to manually search for the server and
call the library increment function. Of course the functions will look a
little different. They will look like this:
int cache_increment (struct sip_msg* msg, char* str1,char * str2 )
{
//...some code to find the appropriate handle in "servers" list
// you should use fix-up functions if you know how
//call the increment method.
return 1; // or -1 on error
}
Hope it helps.
--
Andrei Dragus
www.voice-system.ro<http://www.voice-system.ro>
_______________________________________________
Devel mailing list
Devel at lists.opensips.org<mailto:Devel at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20100224/97fa8328/attachment-0001.htm
More information about the Devel
mailing list