documentcloud / wordpress-documentcloud

Embed DocumentCloud documents that won't be eaten by the visual editor
https://wordpress.org/plugins/documentcloud/
GNU General Public License v2.0
9 stars 14 forks source link

Research cache age of oEmbed response #20

Closed reefdog closed 9 years ago

reefdog commented 9 years ago

WP can cache the oEmbed response; to enable it, we just need to flip WP_DocumentCloud::CACHING_ENABLED to true. But does it obey our cache_age or have its own internal age? Research.

reefdog commented 9 years ago

Gosh, WP oEmbed caching is a mess. After testing and searching the source, here's what I've determined:

So, it seems we must decide between:

  1. No caching; every load of every embed hits us twice (and, even worse for the user experience, synchronously).
  2. Aggressive cache that may never expire.

I vote for #2, partly because I don't believe my own results and have to assume the cache would eventually expire, and partly because stale embed codes are less of a problem than letting WP DDOS us.

knowtheory commented 9 years ago

That sounds... awful?

Remember that this is just for the oembed response... and since our embed codes are normally static anyway... So what i'd say is we should cache as aggressively as possible, and any data changes that are made will be handled through our platform caching & expiry anyway.

reefdog commented 9 years ago

Yup.

eyeseast commented 9 years ago

I think caching the embed code is probably fine. Every raw embed in the wild is essentially the same thing. As long as the underlying document keeps getting fetched, it shouldn't be a problem.

But I concur with Ted: Ick.