在 Caching, Cakephp 中创建子文件夹



我在tmp中有一个缓存文件夹。我想要缓存文件夹中的子文件夹,以便仅在该文件夹中存储特定页面的缓存文件。我该怎么办?

查找引导程序.php 在你的应用程序/配置中

替换以下行

Cache::config('users_cache', array( // users_cache is the custom cache log name
  'engine' => File,
  'prefix' => 'cake_',  
  'path' => CACHE . 'users' . DS, // added sub-directory in users in tmp/cache
  'serialize' => true,
  'duration' => '+360 minutes'
));

现在,在你的app/tmp/cache/users中创建一个目录

然后按以下格式使用它

Cache::write('enter_name', $users,'users_cache');

为了获得最佳参考,请阅读以下文章 Cache::write

最新更新