Posts in category ‘Templates’.
New Templates System
New templates system was introduces to the CppCMS framework. It is based on ideas of dynamic typed languages inside static typed C++.
The original template system had several problems:
- The each template variable was referenced by and integer key that was generated during compilation of templates.
- The rendering process required from the developer some kind of activity -- update content values according to requests from rendering engine.
- The values of the entries where limited to string, integer and boolean values.
In any case, the design of the first template system was just unacceptable, thus new template system was build.
It introduced following features:
- Dynamic typed variable values using boost::any. They allow assigning of any kind of objects to the variables and rendering them to the templates using custom engines.
- All the variables are references by their names.
- Content now has hierarchical structure when each variable can include list of items or callbacks that allow one step template rendering.
- The design of the engine is now much more modular.
Additional features I'm still working on them are:
- Support of different filters like "html escaping", "urlizing" etc.
- Support of custom filters, including filter chains.
- Support of localization and translation.
Next Step - Caching
As we had seen in previous article, the benchmarks had shown an ability of CppCMS to produce about 630 compressed pages per second and an output of about 20Mbit/s. Is this enough?
For most of cases it is... But as we had seen I want to use every cycle of the CPU as smart as I can. Even, if the model I had suggested, was able to show "a prove of concept" there is an important point that was missed: "Why should I create same page so many times?"
Caching
This is the next logical step in the development of high performance web development framework.
First of all we should understand a requirements of the caching system:
- Efficiency
- Support of "dropping cache on update"
- Support of drop the cache by timeout
- Work using three models: single process cache, shared cache between processes, shared over the network.
- Support of caching on entry page level and single view level as well
- Transparent storage of compressed content
Lets describe each one of them:
more...Components of CppCMS
There are several important components that CppCMS implements:
- FastCGI Application Framework
- Easy Berkeley DB -- Simple API to BDB
- Templates System
- Text Tools -- text to html conversion tools
- Nice URLs support
I'll describe there all these in details there
more...