[Gambas-devel] gb.memcached

Benoît Minisini gambas at ...1...
Wed Sep 26 14:38:16 CEST 2012


Le 26/09/2012 13:59, Benoît Minisini a écrit :
> Le 26/09/2012 06:50, Sebastian Kulesz a écrit :
>> Hi!
>>
>> In rev 5206 i added a memcached client. It's fully implemented and
>> works perfect, except for one thing, i only managed to store strings
>> :(
>>
>> It's not that i could not store other datatypes, in fact, it can
>> (strings are easy to debug), but the memcached server relies in the
>> client to send the byte size of the data it has to store, which proved
>> to be really hard to calculate. It should be trivial to also implement
>> other native datatypes (i.e. integers, floats, etc) with a *really
>> big* if structure. But the problem was with arrays and collections.
>> Although the interpreter can serialize the objects, i *previously*
>> need to send the byte size of the blob.
>>
>> If you look at the code, you will see that in the Store() function i
>> hard coded an if statement to calculate the offset based on the length
>> of the string (using the "Binary Data Representation" wiki page [0] ).
>> The same could be done with integers, for example, but couldn't find a
>> way to do this for objects.
>>
>> My question is: Would it be possible to expose the (de)serialization
>> functions and return the blob as an utf-8 string? It would then be
>> trivial to implement the rest
>>
>> In the meantime, you are free to play only with strings ;)
>>
>> Thanks!
>>
>> [0] http://gambasdoc.org/help/cat/datarep?v3
>>
>
> What's the use of memcached?
>

Other points:

- As in gb.net.pop3, you must not make public symbols related to the 
underlying protocol.

- Public constants must be named with the Pascal convention 
('TheConstantName' and not 'THE_CONSTANT_NAME')

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list