Test.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\cache\driver;
  12. use think\cache\Driver;
  13. use think\Container;
  14. /**
  15. * 文件类型缓存类
  16. * @author liu21st <liu21st@gmail.com>
  17. */
  18. class Test extends Driver
  19. {
  20. protected $options = [
  21. 'expire' => 0,
  22. 'cache_subdir' => true,
  23. 'prefix' => '',
  24. 'path' => '',
  25. 'hash_type' => 'md5',
  26. 'data_compress' => false,
  27. 'serialize' => true,
  28. ];
  29. protected $expire;
  30. /**
  31. * 架构函数
  32. * @param array $options
  33. */
  34. public function __construct($options = [])
  35. {
  36. return false;
  37. }
  38. /**
  39. * 初始化检查
  40. * @access private
  41. * @return boolean
  42. */
  43. private function init()
  44. {
  45. // 创建项目缓存目录
  46. try {
  47. if (!is_dir($this->options['path']) && mkdir($this->options['path'], 0755, true)) {
  48. return true;
  49. }
  50. } catch (\Exception $e) {
  51. }
  52. return false;
  53. }
  54. }