CacheService.php 745 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2018/01/05
  6. */
  7. namespace service;
  8. use think\Cache;
  9. class CacheService
  10. {
  11. protected static $globalCacheName = '_cached_1515146130';
  12. public static function set($name, $value, $expire = 0)
  13. {
  14. return self::handler()->set($name,$value,$expire);
  15. }
  16. public static function get($name,$default = false)
  17. {
  18. return self::handler()->get($name,$default);
  19. }
  20. public static function rm($name)
  21. {
  22. return self::handler()->rm($name);
  23. }
  24. public static function handler()
  25. {
  26. return Cache::tag(self::$globalCacheName);
  27. }
  28. public static function clear()
  29. {
  30. return Cache::clear(self::$globalCacheName);
  31. }
  32. }