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:
Fetching the HTML source of the page being transformed to Instant Articles.
Creating an Instant Article object from the rules and source HTML.
Generating the markup used for preview (using AMP) of a given Instant Article.
Retrieving the transformation warnings for a given URL and a set of rules.
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.
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.