[WEB] Wordpress : DB-Cache et Memcached
par Aki, vendredi 24 juillet 2009 à 22:19 :: Informatique :: #21 :: rss
Installer le plugin DB Cache, l'activer et modifier db-functions.php comme suit :
<?php
/**
* Cache framework
* Author: Dmitry Svarytsevych
* http://design.lviv.ua
* Memcached Support by Romain BOURDY
* http://www.aki-project.net
*/
class pcache {
var $m;
function pcache(){
$this->m = new Memcache();
$this->m->connect('localhost', 11211);
}
function load($tag = '') {
if ($tag == '') return false;
return $this->m->get('wp_db_'.$tag);
}
function save($value = , $tag = ) {
$this->m->set('wp_db_'.$tag,$value,MEMCACHE_COMPRESSED,600);
return true;
}
function remove($tag = '', $dir = false) {
$this->m->delete('wp_db_'.$tag);
return true;
}
function clean($old = true) { }
}
?>
TODO :
- Gerer les clean()
- Gerer le timeout
- Prefixe personalisé ?
Commentaires
1. Le lundi 27 juillet 2009 à 10:15, par Victor Petit
2. Le mercredi 5 août 2009 à 11:39, par Aki
Ajouter un commentaire