タグ

2009年5月21日のブックマーク (2件)

  • CakePHP cache()はCache::write()に

    CakePHPにはキャッシュを行う関数cache()があるのですが、1.2.2のソースを見るとdeprectatedになってました。 [cake/basics.php] <?php /** * Reads/writes temporary data to cache files or session. * * @param string $path File path within /tmp to save the file. * @param mixed $data The data to save to the temporary file. * @param mixed $expires A valid strtotime string when the data expires. * @param string $target The target of the cached da

  • [CakePHP]キャッシュ関数を使う際の注意

    概要 CakePHPにはcache関数という素敵な関数があります。 手軽にデータをキャッシュしておけるのが便利で、APIから取得したデータをキャッシュするのに使ったりしています*1 。 このキャッシュ関数の使い方と注意点を簡単にまとめておきます。 使い方 /* $path string キャッシュを保存するパスを指定 $data mixed 保存するテキストを指定、nullの場合指定したキャッシュを探して読み込む $expires mixed strtotimeに使える形式でキャッシュの保存期間を指定 $target string 保存場所を下記から指定 "cache" = CACHE . $path, "public" = WWW_ROOT . $path;, "tmp" = TMP . $path; */ cache($path, $data = null, $expires = '+

    [CakePHP]キャッシュ関数を使う際の注意