memory_driver_wincache.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: memory_driver_wincache.php 31432 2012-08-28 03:04:18Z zhangguosheng $
  7. */
  8. if (!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class memory_driver_wincache {
  12. public $cacheName = 'WinCache';
  13. public $enable;
  14. public function env() {
  15. return function_exists('wincache_ucache_meminfo') && wincache_ucache_meminfo();
  16. }
  17. public function init($config) {
  18. $this->enable = $this->env();
  19. }
  20. public function get($key) {
  21. return wincache_ucache_get($key);
  22. }
  23. public function getMulti($keys) {
  24. return wincache_ucache_get($keys);
  25. }
  26. public function set($key, $value, $ttl = 0) {
  27. return wincache_ucache_set($key, $value, $ttl);
  28. }
  29. public function rm($key) {
  30. return wincache_ucache_delete($key);
  31. }
  32. public function clear() {
  33. return wincache_ucache_clear();
  34. }
  35. public function inc($key, $step = 1) {
  36. return wincache_ucache_inc($key, $step);
  37. }
  38. public function dec($key, $step = 1) {
  39. return wincache_ucache_dec($key, $step);
  40. }
  41. }