Hello,

2012/2/20 Simone Tripodi <[email protected]>:
>> Hmmmm. Simone should answer this.
>>
>> If I'm really thinking about it, the content-type makes no sense. ;)
>
> it does instead, because the server has to be able to reply the
> serialization content type when clients ask for stored - or you expect
> the client automagically understands it? Or you expect to have just
> one client type per application, so the serialization type is always
> the same? Couldn't servers be populated by heterogeneous clients that
> read each other data?
The client will be responsible for de/serialization.
My preference for more "complex" content is for new feature and
enhance cache request/response with new field.

retrieve object :
GET on ${webPath}/cache/${key}

return json content if found

{"DirectMemoryRS":{"key":"101","cacheContent":"Zm9vIGJhcg=="}}
Using this format we will be able to add new fields in the ison
"object" (cacheAge etc...)

PUT on ${webPath}/cache

json content posted

{"DirectMemoryRQ":{"key":"101","expiresIn":123,"cacheContent":"rO0ABXNyACtvcmcuYXBhY2hlLmRpcmVjdG1lbW9yeS5zZXJ2ZXIuY29tbW9ucy5XaW5l5dYKhxyAjeECAAFMAARuYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7eHB0AAhCb3JkZWF1eA==","serializer":"org.apache.directmemory.serialization.StandardSerializer"}}

Again using a json "object" we will be able to easily add new "fields".

Why using json I have in mind using cache access directly tru a
javascript application with something like :

{"DirectMemoryRQ":{"key":"101","expiresIn":123,"cacheContent":"*here a
json/xml string*
","serializer":"org.apache.directmemory.serialization.StandardSerializer"}}

As it the server we will be able to serialize then store the json/xml content.
And you can use directly from your javascript application.

Compare to an Api.

wineService.findWine(year, name)

wineService.find(wineSearchRequest)

With
WineSearchRequest {
  year;
  name;
}

I tend to prefer using the second pattern as it's more easy to improve
the model without breaking (normally :-) ) the backward comp.

Makes sense ?

>
> "makes no sense" is a hard assertion, I always think more than twice
> before saying that ;)
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Reply via email to