| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\common\cache;
- /**
- * Info信息缓存类
- * Class InfoCache
- * @package app\common\cache
- */
- class InfoCache extends BaseCache
- {
- protected $tagName = 'info';
-
- /**
- * @notes 获取Info详情缓存
- * @param $id
- * @return false|mixed
- * @author Tab
- * @date 2021/7/14 15:13
- */
- public function getInfoDetail($id)
- {
- $cacheKey = $this->tagName . '_detail_' . $id;
- $info = $this->get($cacheKey);
- if($info) {
- return $info;
- }
- return false;
- }
-
- /**
- * @notes 设置Info详情缓存
- * @param $id
- * @param $data
- * @param int $expire 缓存过期时间,默认1小时
- * @author Tab
- * @date 2021/7/14 15:13
- */
- public function setInfoDetail($id, $data, $expire = 3600)
- {
- $cacheKey = $this->tagName . '_detail_' . $id;
- $this->set($cacheKey, $data, $expire);
- }
-
- /**
- * @notes 删除Info详情缓存
- * @param $id
- * @author Tab
- * @date 2021/7/14 15:13
- */
- public function deleteInfoDetail($id)
- {
- $cacheKey = $this->tagName . '_detail_' . $id;
- $this->delete($cacheKey);
- }
- }
|