[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/cache/ -> sfFileCache.class.php (sommaire)

(pas de description)

Poids: 595 lignes (14 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

sfFileCache:: (22 méthodes):
  __construct()
  initialize()
  setSuffix()
  setWriteControl()
  getWriteControl()
  setFileLocking()
  getFileLocking()
  setCacheDir()
  getCacheDir()
  get()
  has()
  set()
  remove()
  clean()
  lastModified()
  getFileName()
  unlink()
  cleanDir()
  read()
  write()
  writeAndControl()
  hash()


Classe: sfFileCache  - X-Ref

Cache class that stores content in files.

This class is based on the PEAR_Cache_Lite class.
All cache files are stored in files in the [sf_root_dir].'/cache/'.[sf_app].'/template' directory.
To disable all caching, you can set to false [sf_cache] setting.

__construct($cacheDir = null)   X-Ref
Constructor.

param: string The cache root directory

initialize($options = array()   X-Ref
Initializes the cache.

param: array An array of options

setSuffix($suffix)   X-Ref
Sets the suffix for cache files.

param: string The suffix name (with the leading .)

setWriteControl($boolean)   X-Ref
Enables / disables write control.

param: boolean

getWriteControl()   X-Ref
Gets the value of the writeControl option.

return: boolean

setFileLocking($boolean)   X-Ref
Enables / disables file locking.

param: boolean

getFileLocking()   X-Ref
Gets the value of the fileLocking option.

return: boolean

setCacheDir($cacheDir)   X-Ref
Sets the cache root directory.

param: string The directory where to put the cache files

getCacheDir()   X-Ref
Pas de description

get($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)   X-Ref
Tests if a cache is available and (if yes) returns it.

param: string  The cache id
param: string  The name of the cache namespace
param: boolean If set to true, the cache validity won't be tested
return: string  Data of the cache (or null if no cache available)

has($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)   X-Ref
Returns true if there is a cache for the given id and namespace.

param: string  The cache id
param: string  The name of the cache namespace
param: boolean If set to true, the cache validity won't be tested
return: boolean true if the cache exists, false otherwise

set($id, $namespace = self::DEFAULT_NAMESPACE, $data)   X-Ref
Saves some data in a cache file.

param: string The cache id
param: string The name of the cache namespace
param: string The data to put in cache
return: boolean true if no problem

remove($id, $namespace = self::DEFAULT_NAMESPACE)   X-Ref
Removes a cache file.

param: string The cache id
param: string The name of the cache namespace
return: boolean true if no problem

clean($namespace = null, $mode = 'all')   X-Ref
Cleans the cache.

If no namespace is specified all cache files will be destroyed
else only cache files of the specified namespace will be destroyed.

param: string The name of the cache namespace
return: boolean true if no problem

lastModified($id, $namespace = self::DEFAULT_NAMESPACE)   X-Ref
Returns the cache last modification time.

return: int The last modification time

getFileName($id, $namespace)   X-Ref
Makes a file name (with path).

param: string The cache id
param: string The name of the namespace
return: array An array containing the path and the file name

unlink($file)   X-Ref
Removes a file.

param: string The complete file path and name
return: boolean true if no problem

cleanDir($dir, $mode)   X-Ref
Recursive function for cleaning cache file in the given directory.

param: string  The directory complete path
param: string  The name of the cache namespace
param: string  The flush cache mode : 'old', 'all'
return: boolean true if no problem

read($path, $file)   X-Ref
Reads the cache file and returns the content.

param: string The file path
param: string The file name
return: string The content of the cache file.

write($path, $file, $data)   X-Ref
Writes the given data in the cache file.

param: string The file path
param: string The file name
param: string The data to put in cache
return: boolean true if ok

writeAndControl($path, $file, $data)   X-Ref
Writes the given data in the cache file and controls it just after to avoid corrupted cache entries.

param: string The file path
param: string The file name
param: string The data to put in cache
return: boolean true if the test is ok

hash($data)   X-Ref
Makes a control key with the string containing datas.

param: string $data data
return: string control key



Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7