Class: zen_cache

Source Location: /zenphp/clases/clase_zen_cache.php

Class Overview [line 54]


zen_cache Una clase muy simple para guardar cache de contenidos

Author(s):

Version:

Copyright:

Variables

Constants

Methods


Inherited Variables

Inherited Constants

Inherited Methods



Class Details

zen_cache Una clase muy simple para guardar cache de contenidos

Uso:

$cache = new zen_cache('micache'); $contenido = $cache->obtener(); if(!$contenido) { // obtener el contenido $contenido = zen_plantilla::cargar('fichero'); //...u otro $cache->guardar($contenido); } echo $contenido;

[ Top ]


Class Variables

$contenido

[line 60]

Contenido a almacenar en cache.Un fichero HTML,XML,etc

Type: str

Overrides:

[ Top ]

$id

[line 66]

Identificador para el fichero de cache,un nombre

Type: str

Overrides:

[ Top ]

$limite_horas =  1

[line 72]

Tiempo en el que expira la cache en horas,1h por defecto

Type: str

Overrides:

[ Top ]

$ruta_cache

[line 78]

Ruta para escribir el fichero de cache

Type: str

Overrides:

[ Top ]


Class Methods

zen_cache

zen_cache zen_cache( [string $id = false])

[line 87]

zen_cache::Constructor

Inicializa la clase, si un se un ID fue especificado,se establece como propiedad de la clase

Tags:

  • access - protected

Parameters:

  • string $id -

[ Top ]

establecer_contenido

void establecer_contenido( [ $contenido = false], string $content)

[line 153]

zen_cache::establecer_contenido()

Establece el contenido para esta cache

Tags:

  • access - protected

Parameters:

  • string $content -
  • $contenido -

[ Top ]

establecer_id

void establecer_id( [string $id = false])

[line 165]

zen_cache::establecer_id()

Establece la propiedad de ID (identificador unico) para el fichero de cache

Tags:

  • access - protected

Parameters:

  • string $id -

[ Top ]

establecer_limite_horas

void establecer_limite_horas( [int $limite_horas = false])

[line 177]

zen_cache::establecer_limite_horas()

Establece el tiempo limite (en horas) para que el fichero caduque

Tags:

  • access - protected

Parameters:

  • int $limite_horas -

[ Top ]

guardar

true guardar( [str $contenido = false], [str $id = false])

[line 124]

Intenta guardar el contenido pasado como argumento en el fichero de cache.

Tags:

  • return - si todo fue correcto

Parameters:

  • str $contenido -
  • str $id -

[ Top ]

limpiar

bool limpiar( [str $id = false])

[line 141]

zen_cache::limpiar_cache()

Limpia la cache - i.e.: borra el fichero de cache

Parameters:

  • str $id -

[ Top ]

obtener

string|false obtener( [str $id = false], [int $limite_horas = false])

[line 102]

zen_cache::obtener_cache() Intenta obtener la version de la cache especificada por la id.

Si se obtiene ,se devuelve el contenido del fichero de cache como una cadena,pero si la cache a expirado o no existe el fichero, se devuelve falso. as a string. If cache has expired, limpiars cache and returns false, if

Parameters:

  • str $id -
  • int $limite_horas -

[ Top ]

obtener_expiracion

timestamp obtener_expiracion( [int $limite_horas = false])

[line 204]

zen_cache::obtener_expiracion() Obtiene una marca de tiempo de la expiracion de la cache,i.e.:obtiene el dato tiempo en que se creo el fichero antes de que expire.Si se crea antes de que expire, es correcto.

Parameters:

  • int $limite_horas -

[ Top ]

obtener_ruta_cache

string obtener_ruta_cache( [str $id = false])

[line 189]

zen_cache::obtener_ruta_cache()

Obtiene la ruta del fichero de cache con el $id especificado

Parameters:

  • str $id -

[ Top ]


Class Constants


Documentation generated on Fri, 14 Dec 2007 13:14:10 +0100 by phpDocumentor 1.4.0a2