facebookarchive / instant-articles-builder

Instant Articles Rules Editor
https://facebook.github.io/instant-articles-builder
Other
125 stars 67 forks source link

Add support for webserver with cache #165

Closed pestevez closed 3 years ago

pestevez commented 3 years ago

This PR is the first of a series aimed at optimize the way the preview webserver works. In this one, I am adding a cache that removes the need to perform certain repetitive operations like:

The approach I took is that the webserver should continue to work even if the chosen cache infra (memcached) is not available. That means that for the local webserver the local cache is not expected to be used (unless you have the Memcached php client installed locally and have a server available with the name memcached) but that a remote webserver could benefit from using cache.

I am including a set of Docker containers (which you can run using docker-compose) that provide a webserver, a memcached server, and a web UI to get stats and even send commands to the memcached server.

In this PR I am only modifying the preview.php file, since @nataliemt already worked on #162 to get the webserver to return a JSON response that can be used.

Note: I need to rebase.