Follow @digitalpardoe on

It's Almost Complete

Today I’ve added what I believe are the final touches to the website back end. The main change is that I have finally been able to enable caching fully so the website will run much, much faster and reduce the load on my hosts server.

I thought in this post I had also better explain the architecture of the website and its caching a little bit for other people that would like to write a Ruby on Rails system for themselves. The website structure is based primarily on the 4 sections you can see in the navigation bar at the top of the page plus separate administration and account sections.

Only the 4 sections in the navigation bar have any sort of caching applied to them, all areas of these sections use page caching rather than other forms of caching, as it is generally faster. However in setting up caching I came across the problem of aspects of pages that require regular, specific modification such as the login information on the right hand side of the website or comments in blog pages, remained unchanged due to the cache. I could have sorted this by continually cleaning the caches or using fragment caching, but I wanted the website to be as fast as possible. I got around this problem through the use of AJAX.

All dynamic items on all pages of the website are called using AJAX (with the help of the Prototype framework). When you load the website you may see loading symbols in the “Account” box to the right or where the comments section is at the bottom of blog pages. The information that is called by the AJAX is not cached and is generated dynamically for every user, because the AJAX calls are JavaScript in each page only the JavaScript is cached rather than the visible product of the JavaScript.

With all modern browsers supporting the JavaScript required to implement AJAX calls, I believe this to be a valid way of using Rails page caching to my advantage.

I will write something more in depth soon, for now try for all your caching needs.

Back soon.