Memcached/JSONP

dylanz nginx-forum at nginx.us
Sun Dec 20 00:08:11 MSK 2009


Hello!

We have an API which makes heavy use of JSONP.
In context, that means the body of the response from our API must be wrapped in a callback parameter that's passed in the same request.

We currently store the JSON output from our API in Memcached, and on subsequent requests, we jump into our application, pull the JSON output out of Memcached, wrap the output in the callback parameter, and return the response.  This works OK, but we'd much rather utilize Nginx and its Memcached module.

So, I was thinking it would be great if we could do the following.  We would store the JSON output from our API in Memcached, base on the URI.  On subsequent requests, the key would be found via the Memcached module, and the output wrapped in the current requests callback parameter.  This way we wouldn't need to jump into our application, and everything would be handled via Nginx.

This would obviously require some customizations/extensions to the Memcached module, and wanted to get some feedback to see if this scenario was plausible, if there were better approaches, etc.

Any suggestions, etc, would be greatly appreciated,
Thanks!
==
Dylan

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,31961,31961#msg-31961




More information about the nginx mailing list