123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\common\cache;
-
-
- class ExportCache extends CacheBase
- {
-
- protected $uniqid = '';
-
- public function __construct($key = '')
- {
- parent::__construct($key);
-
- $this->uniqid = md5(uniqid($this->name,true).mt_rand());
- }
-
-
-
-
- public function getSrc()
- {
- return app()->getRootPath() . 'runtime/file/export/'.date('Y-m').'/'.$this->uniqid.'/';
- }
-
-
-
-
- public function setFile($fileName)
- {
- $src = $this->getSrc();
- $key = md5($src . $fileName) . time();
- $this->cacheSet($key, ['src' => $src, 'name' => $fileName], 300);
- return $key;
- }
-
-
-
-
- public function getFile($key)
- {
- return $this->cacheGet($key);
- }
-
-
-
- public function setTag()
- {
- return 'export';
- }
-
- public function setData()
- {
- }
-
- }
|