Tag Archives: large scale web application

Setting Up Global Cache in Zend Framework

In a large scale web application, especially based on Zend Framework, there are lot’s of components that support built in cache support. Such are Zend_Db, Zend_Translate, Zend_Date, etc. Also you may need cache support wherever in the app, so my advice is to setup a cache instance in the “beginning”, into the bootstrap.php or even better – into a front controller plugin, and to store it into the Zend_Registry. Thus you’ve to change only the lifetime for specific needs:

class CacheInit extends Zend_Controller_Plugin_Abstract
    public function __construct()
        $frontendOptions = array(
            'automatic_serialization' => true,
            'lifetime' => 60
        $backendOptions  = array(
            'cache_dir' => realpath(APPLICATION_PATH . '/../cache')
        $cache = Zend_Cache::factory('Core',
        Zend_Registry::set('cache', $cache);

Than add it as a front controller plugin:

// cache plugin
$frontController->registerPlugin(new CacheInit());

jQuery vs. pure JavaScript

The question is: should I use always jQuery in some large jQuery project? Imagine you’re developing a large scale web application where the JavaScript part of it is supported by jQuery. In my case that was the reality. In fact in every, even very big, project there are “pages” where you don’t need much of JavaScript. Such pages can be the “about”, “info” or whatever static page there is.

Well the question is, should I again include the hole jQuery if I need only to toggle the visiblity on a DIV element? Let’s assume you’ve very long text, cutted in the beggining with the “more” link somewhere after the intro. That’s very common, isn’t it? So by clicking on the “more” you toggle the visibility of the rest of the text. Well of course it’s absurt if I include the entire library just to make this.

The right answer by me is to use pure JavaScript, something like that:

document.getElementId('id').style.display = 'block'

That will do the same job without to block the “fast” in other way page!