Doctrine: CacheProvider performance-aware adapter

In doctrine/common¬†project, for Cache\CacheProvider, with introduction of cache auto-prefix support¬†(called namespaces by Doctrine guys, but it has nothing to do with PHP namespaces), unfortunately there appeared quite serious performance issue. Every single cache call always resulted in 2 additional cache storage calls due to checks for prefix (cache namespace). Quite a big overhead, imagine your memcached instance is called like this. And it just shows that object-oriented programming itself cannot save you from many headaches. Common interface and clean API are just not everything, and it’s soooo easy to get carried away. Anyway, patch has been already provided, but if you’re using older version or you don’t need namespaces support at all, here’s quick workaround.

  1. by sobstel • May 2012