KumbiaPHP beta2-dev
Framework PHP en español
cache_console.php
Ir a la documentación de este archivo.
00001 <?php
00023 // carga libreria para manejo de cache
00024 Load::lib('cache');
00025  
00026 class CacheConsole
00027 {       
00035     public function clean($params, $group = FALSE)
00036     {
00037         // obtiene el driver de cache
00038         if(isset($params['driver'])) {
00039             $cache  = Cache::driver($params['driver']);
00040         } else {
00041                         $cache = Cache::driver();
00042                 }
00043         
00044         // limpia la cache
00045         if($cache->clean($group)) {
00046             if($group) {
00047                 echo "-> Se ha limpiado el grupo $group", PHP_EOL ;
00048             } else {
00049                 echo "-> Se ha limpiado la cache", PHP_EOL ;
00050             }
00051         } else {
00052             throw new KumbiaException('No se ha logrado eliminar el contenido');
00053         }
00054     }
00055     
00064     public function remove($params, $id, $group = 'default')
00065     {
00066         // obtiene el driver de cache
00067         if(isset($params['driver'])) {
00068             $cache  = Cache::driver($params['driver']);
00069         } else {
00070                         $cache = Cache::driver();
00071                 }
00072         
00073         // elimina el elemento
00074         if($cache->remove($id, $group)) {
00075             echo '-> Se ha eliminado el elemento de la cache', PHP_EOL ;
00076         } else {
00077             throw new KumbiaException("No se ha logrado eliminar el elemento \"$id\" del grupo \"$group\"");
00078         }
00079     }
00080 }
 Todo Estructuras de Datos Namespaces Archivos Funciones Variables Enumeraciones