Memcached/JSONP

Peter Leonov gojpeg at gmail.com
Sun Dec 20 05:08:20 MSK 2009


On 20.12.2009, at 4:25, dylanz wrote:

> Hello Peter!
> 
> Thank you for the great suggestion, and after I read up on the SSI module, I think I understand the approach.
> 
> So, the actual content I store in the cache would be something like:
> <!--# include virtual="http://example.com/jsonp_ssi/$args" -->({"cat": meow, "dog": ruff})
> 
> On a subsequent request, that content would be retrieved, and replaced with the response from the request (say, "blah123") to http://example.com/jsonp_ssi/$args.
> That way, I could parse out the callback value in that parallel request, and the response body would end up something like:
> blah123({"cat": meow, "dog": ruff})
> 
> I'd need to make some changes to my application and framework, but if the above is correct, this will definitely work!
We could think a better approach out :)

> I may still keep reading Emillers module guide however, as if this was a body filter, it would save that extra request (and it would be a fun exercise ;)).
Yep, nginx contains a lot of fun :)
By the way, there is a mailing list for developers: http://nginx.org/mailman/listinfo/nginx-devel

> 
> Let me know what you think,
> Thanks!
> ==
> Dylan

Not exactly ;)

AFAIU, you have a memcache full of key/data pairs like this:
john: {age: 20, gender: 'male'}
ann: {age: 18, gender: 'female'}
bill: {age: 31, gender: 'male'}
igor: {age: 39, gender: 'male', genius: true}

And you want to load some value into your page by url like example.com/memc/john with a script tag (cross-domain technique, I guess):
<script src="/memc/john">blah123({age: 20, gender: 'male'})</script>

Are thees suppositions right?

Best regards,
Peter.


More information about the nginx mailing list