What are the best practices for working with oEmbed regarding storing and caching responses?

I am currently working on a site and I am pretty new to working with oembed. What is considered best practice for storing and caching a response? If the final speed is my goal, and the site I'm working on has the potential for a huge amount of traffic, is it better for me to save the database space by simply saving the final and multimedia URLs and running oEmbed GET every time I need to load the page or once, when I have the code to insert, should I store it in my database? I understand that there may be other variables, but I would appreciate any feedback on the things that I should consider when making this decision.

Also, are there any security issues here?

+3
source share
1 answer

I went down the road to save my ombied results in db. I use the embed.ly service to get my oembed objects, and although the response time is generally good, caching responses in db greatly improves client performance.

I also set up a service that runs once a day (it seems enough) and updates db-cache once a day.

One thing that can become a problem is getting oembed with a given size (e.g. max-width). Changing the built-in html / flash to another size on the fly will not be funny ...

+5
source

Source: https://habr.com/ru/post/1756097/


All Articles