[sr-dev] redis module support for array responses.

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 10 23:30:28 CEST 2012


Hello,

thanks for the contribution, the patch was applied to git master branch.

For the future, adding to the module readme has to be done by updating 
the xml (docbook) files located in subfolder doc/ in module's directory. 
Then run:

make modules-readme modules=modules/ndb_redis

the README file for the module will be generated from the xml files by 
the command above.

You need to install xsltproc and docbook xsl/dtd files (all packages in 
common distros such as debian, ubuntu...).

Cheers,
Daniel

On 4/10/12 9:57 PM, Vicente Hernando wrote:
> Hello,
>
> former patch about adding array support to ndb redis module did not 
> follow kamailio coding style guidelines.
>
> This one except for some long lines follows coding style rules right.
>
> Regards,
> Vicente.
>
>
>
> On 04/04/2012 01:22 PM, Vicente Hernando wrote:
>> Hello,
>>
>> here comes attached a patch to add array support for ndb_redis module.
>>
>> This patch is based on parts of sqlops module.
>>
>> it maintains old options: $redis->type and $redis->value, but for 
>> arrays there are new options enabled.
>>
>> $redis->size   -  returns number of array elements.
>>
>> $redis->type[n]  -  returns type of nth array element.
>>
>> $redis->value[n]  -  returns value of nth array element.
>>
>> $redis->type  -  returns array type as in hiredis.h
>>
>> $redis->value  -  returns null for arrays.
>>
>>
>> Regards,
>> Vicente.
>>
>> PS: This is my first patch to the list. Any criticism is welcome!
>>
>>
>> On 03/30/2012 11:47 AM, Daniel-Constantin Mierla wrote:
>>> Hello,
>>>
>>> indeed redis connector is dealing string and integer values by now.
>>>
>>> Extending it for dealing with arrays will be useful, proposed 
>>> variant looks good for me. If you are going to contribute a patch, 
>>> it will be accepted (and appreciated).
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 3/29/12 8:14 PM, Vicente Hernando wrote:
>>>> Hello,
>>>>
>>>> I am studying the use case when a redis command returns an array 
>>>> (REDIS_REPLY_ARRAY type in hiredis.h from 
>>>> https://github.com/antirez/hiredis )
>>>>
>>>> Function pv_get_redisc in 
>>>> kamailio/modules/ndb_redis/ndb_redis_mod.c : 365  returns a 
>>>> pv_value_t structure and currently only deals with REDIS_REPLY_STRING
>>>> and REDIS_REPLY_INTEGER cases.
>>>>
>>>> It seems looking at pvar.h that pv_value_t structure does not deal 
>>>> with arrays. Is that correct? So returning an array is not an 
>>>> option...
>>>>
>>>> Then a better aproach could be changing pv_parse_redisc_name function:
>>>>
>>>> right now from README in ndb_redis:
>>>> after executing redis_cmd("srvN", "SET foo bar", "r");     I could 
>>>> get   $redis(r->type)   and $redis(r->value)
>>>>
>>>> it could be a good idea to add options like:  $redis(r->size)   
>>>> and  $redis(r->value[Number])     when changing 
>>>> pv_parse_redisk_name function.
>>>>
>>>>
>>>> Do you think of that as a good approach?
>>>>
>>>>
>>>> Thanks in advance!
>>>> Vicente.
>>>>
>>>>
>>>> _______________________________________________
>>>> sr-dev mailing list
>>>> sr-dev at lists.sip-router.org
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>
>>
>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>

-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120410/7785dc98/attachment.htm>


More information about the sr-dev mailing list