Translation2_Decorator_CacheLiteFunction クラス概要

Translation2_Decorator_CacheLiteFunction クラス概要 – Cache_Lite_Function クラスを用いて、取得したデータをキャッシュするデコレータ

Cache_Lite_Function デコレータの例

このデコレータは、非常に効率的なキャッシュを提供します。 PEAR::Cache_Lite が必要です。Cache_Lite がサポートするオプション

  • lifeTime [integer]

  • cacheDir [string]

  • fileLocking [boolean]

  • caching [boolean]

をすべてサポートしています。 オプションを直接 Cache_Lite オブジェクトに渡すには、 setCacheOption() を使用します。

<?php
$tr 
= new Translation2($driver$dbinfo$params);
$tr =& $tr->getDecorator('CacheLiteFunction');
$tr->setOption('cacheDir''/var/tmp/');
$tr->setOption('lifeTime'3600*24*7); // 一週間

// 独自の Cache_Lite オプションを設定します
$tr->setCacheOption($name$value);
?>