wincache.init.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. if (!defined('IS_INITPHP')) exit('Access Denied!');
  3. /*********************************************************************************
  4. * InitPHP 3.8.1 国产PHP开发框架 Dao-WINCACHE缓存
  5. *-------------------------------------------------------------------------------
  6. * 版权所有: CopyRight By initphp.com
  7. * 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
  8. *-------------------------------------------------------------------------------
  9. * $Author:zhuli
  10. * $Dtime:2013-5-29
  11. ***********************************************************************************/
  12. class wincacheInit {
  13. /**
  14. * Xcache缓存-设置缓存
  15. * 设置缓存key,value和缓存时间
  16. * @param string $key KEY值
  17. * @param string $value 值
  18. * @param string $time 缓存时间
  19. */
  20. public function set_cache($key, $value, $time = 0) {
  21. return wincache_ucache_set($key, $value, $time);
  22. }
  23. /**
  24. * Xcache缓存-获取缓存
  25. * 通过KEY获取缓存数据
  26. * @param string $key KEY值
  27. */
  28. public function get_cache($key) {
  29. return wincache_ucache_get($key);
  30. }
  31. /**
  32. * Xcache缓存-清除一个缓存
  33. * 从memcache中删除一条缓存
  34. * @param string $key KEY值
  35. */
  36. public function clear($key) {
  37. return wincache_ucache_delete($key);
  38. }
  39. /**
  40. * Xcache缓存-清空所有缓存
  41. * 不建议使用该功能
  42. * @return
  43. */
  44. public function clear_all() {
  45. return wincache_ucache_clear();
  46. }
  47. }