开发者

Should I uniform different API calls to a single format before caching?

开发者 https://www.devze.com 2023-02-04 05:03 出处:网络
The problem is that I am recreating the social media widget/icons on http://about.me/bluedaniel (thats me).

The problem is that I am recreating the social media widget/icons on http://about.me/bluedaniel (thats me).

Anyhow there can be up to 6 or 7 different API calls on the page and obviously I am caching them, at the moment with Memcached.

The question is, as they arrive in various formats开发者_如何学JAVA and sizes (fb-json, linkedin-xml, wordpress-rss etc), should I universally format/convert them before storing it in the cache.

At present I have recreated the html widget and then stored that, but I worry about saving huge blocks of html in the cache as it doesn't seem that smart.


Doing IO(disc) is expensive. That's why you should have a copy of the data in memory(memcached). But when you have a single data representation in memory then you can without almost any effort do the conversion because it is CPU-bound(CPU is not slowing you down) as long as your not touching the disc.

0

精彩评论

暂无评论...
验证码 换一张
取 消