4 * PDO Cache Handler with GZIP support
6 * $cnx = new PDO("mysql:host=localhost;dbname=mydb", "username", "password");
7 * $smarty->setCachingType('pdo_gzip');
8 * $smarty->loadPlugin('Smarty_CacheResource_Pdo_Gzip');
9 * $smarty->registerCacheResource('pdo_gzip', new Smarty_CacheResource_Pdo_Gzip($cnx, 'smarty_cache'));
11 * @require Smarty_CacheResource_Pdo class
12 * @author Beno!t POLASZEK - 2014
14 require_once 'cacheresource.pdo.php';
16 class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo
20 * Encodes the content before saving to database
22 * @param string $content
23 * @return string $content
26 protected function inputContent($content)
28 return gzdeflate($content);
32 * Decodes the content before saving to database
34 * @param string $content
35 * @return string $content
38 protected function outputContent($content)
40 return gzinflate($content);