Using cache engines with Volt and Asset Manager


First off, I'm really excited to try out Phalcon for a production system!

We'll be using a load-balanced AWS cluster with MySQL, so I was wondering if there was a way to minimize I/O by storing compiled Volt templates in a cache engine such as APC or Memcache?

I would also like to be able to serve up joined/minified Asset Manager groups without writing them to disk first so that the CDN can pick them up and serve them cached. Is there a way to handle this without any file operations?

Warm Regards, Torgny

You can definitely do all that you are looking for. Your setup will determine what cache and how it will be used.

1) Using Volt templates and storing them in a cache.

You can cache output fragments

You can use the viewCache service (you need to register it first). Have a look at these two (from the website repo on github which is the code behind (init service) (how to use)

  1. You can minify the resources before your site goes into production. In that case you only have one file for the CDN to pick up and there are no file operations once the CDN picks it up. If you want to use joined/minified groups you will need to store them somewhere so that the CDN can pick them up (if you are using a pull CDN zone). If not then you can use an API of sorts (that the CDN provider offers) to send the data over to them and then use only the CDN resource.