[ Index ]
 

Code source de PHP PEAR 1.4.5

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

title

Body

[fermer]

/Cache/ -> OutputCompression.php (sommaire)

(pas de description)

Poids: 301 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 1 fichier
 Cache/Output.php

Définit 1 class

Cache_OutputCompression:: (12 méthodes):
  Cache_OutputCompression()
  _Cache_OutputCompression()
  generateID()
  get()
  end()
  endPrint()
  extSave()
  printContent()
  isCompressed()
  setEncoding()
  getEncoding()
  _importGlobalVariable()


Classe: Cache_OutputCompression  - X-Ref

Cache using Output Buffering and contnet (gz) compression.
Usage example:

// place this somewhere in a central config file
define(CACHE_STORAGE_CLASS, 'file');
// file storage needs a dir to put the cache files
define(CACHE_DIR, '/var/tmp/');

// get a cache object
$cache = new Cache_Output(CACHE_STORAGE_CLASS, array('cache_dir' => CACHE_DIR));

if (!($content = $cache->start($cache->generateID($REQUEST_URI)))) {
print "hello world";
$cache->endPrint(+1000);
}
else {
$cache->printContent();
}

OR

if (($content = $cache->start($cache->generateID($REQUEST_URI)))) {
$cache->printContent();
die();
}
print "hello world";
$cache->endPrint(+1000);


Based upon a case study from Christian Stocker and inspired by jpcache.

Cache_OutputCompression($container, $container_options = '', $encoding = 'auto')   X-Ref
Sets the storage details and the content encoding used (if not autodetection)

param: string  Name of container class
param: array   Array with container class options
param: string  content encoding mode - auto => test which encoding the user accepts

_Cache_OutputCompression()   X-Ref
Call parent deconstructor.


generateID($variable)   X-Ref
Pas de description

get($id, $group)   X-Ref
Pas de description

end($expire = 0, $userdata = '')   X-Ref
Stops the output buffering, saves it to the cache and returns the _compressed_ content.

If you need the uncompressed content for further procession before
it's saved in the cache use endGet(). endGet() does _not compress_.

endPrint($expire = 0, $userdata = '')   X-Ref
Pas de description

extSave($id, $cachedata, $userdata, $expires = 0, $group = 'default')   X-Ref
Saves the given data to the cache.


printContent($content = '')   X-Ref
Sends the compressed data to the user.

param: string

isCompressed()   X-Ref
Returns the encoding method of the current dataset.

return: string  Empty string (which evaluates to false) means no compression

setEncoding($encoding = 'auto')   X-Ref
Sets the encoding to be used.

param: string  "auto" means autodetect for every client

getEncoding()   X-Ref
Returns the encoding to be used for the data transmission to the client.


_importGlobalVariable($variable)   X-Ref
Import variables from special namespaces.

param: string Type of variable (server, session, post)
return: array



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7