Cache.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\store\controller\setting;
  13. use think\response\Json;
  14. use app\store\service\setting\Clear as ClearService;
  15. use app\store\controller\Controller;
  16. /**
  17. * 清理缓存
  18. * Class Index
  19. * @package app\store\controller
  20. */
  21. class Cache extends Controller
  22. {
  23. /**
  24. * 数据缓存项目(只显示key和name)
  25. * @return Json
  26. */
  27. public function items(): Json
  28. {
  29. $ClearService = new ClearService;
  30. $items = $ClearService->items();
  31. return $this->renderSuccess(compact('items'));
  32. }
  33. /**
  34. * 清理缓存
  35. * @return Json
  36. */
  37. public function clear(): Json
  38. {
  39. $ClearService = new ClearService;
  40. $ClearService->rmCache($this->postForm()['keys']);
  41. return $this->renderSuccess('操作成功');
  42. }
  43. }