@@ 35-50 (lines=16) @@ | ||
32 | * @param string $group nombre de grupo |
|
33 | * @throw KumbiaException |
|
34 | */ |
|
35 | public function clean($params, $group = '') |
|
36 | { |
|
37 | // obtiene el driver de cache |
|
38 | $cache = $this->setDriver($params); |
|
39 | ||
40 | // limpia la cache |
|
41 | if ($cache->clean($group)) { |
|
42 | if ($group) { |
|
43 | echo "-> Se ha limpiado el grupo $group", PHP_EOL; |
|
44 | } else { |
|
45 | echo "-> Se ha limpiado la cache", PHP_EOL; |
|
46 | } |
|
47 | } else { |
|
48 | throw new KumbiaException('No se ha logrado eliminar el contenido de la cache'); |
|
49 | } |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * Comando de consola para eliminar un elemento cacheado |
|
@@ 60-71 (lines=12) @@ | ||
57 | * @param string $group nombre de grupo |
|
58 | * @throw KumbiaException |
|
59 | */ |
|
60 | public function remove($params, $id, $group = 'default') |
|
61 | { |
|
62 | // obtiene el driver de cache |
|
63 | $cache = $this->setDriver($params); |
|
64 | ||
65 | // elimina el elemento |
|
66 | if ($cache->remove($id, $group)) { |
|
67 | echo '-> Se ha eliminado el elemento de la cache', PHP_EOL; |
|
68 | } else { |
|
69 | throw new KumbiaException("No se ha logrado eliminar el elemento \"$id\" del grupo \"$group\""); |
|
70 | } |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * Devuelve una instancia de cache del driver pasado |