CMemdUtil.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. //
  3. //namespace loyalsoft;
  4. //
  5. ///**
  6. // * Description of CMemdUtil
  7. // * CMemd工具类[CMem线上版]
  8. // * @deprecated since version 2017.08.08
  9. // * @author jgao,gwang
  10. // */
  11. //class CMemdUtil extends CMemBase
  12. //{
  13. //
  14. // //put your code here
  15. // public $mem = 0;
  16. // public $keyDic = null;
  17. //
  18. // public function conn($host, $port, $pwd = "")
  19. // {
  20. // $this->mem = new Memcached();
  21. // $this->mem->addServer($host, $port);
  22. // $this->keyDic = new \stdClass();
  23. // }
  24. //
  25. // public function get($key)
  26. // {
  27. // $cas_token = "";
  28. // $result = $this->mem->get($key, null, $cas_token);
  29. // if (!$result || $result == "" || $result == null) {
  30. // return null;
  31. // }
  32. // $this->keyDic->$key = $cas_token;
  33. // return JsonUtil::decode($result);
  34. // }
  35. //
  36. // public function set($key, $value, $ts = 0)
  37. // {
  38. // if ($value == null || $value == "") {
  39. // return false;
  40. // }
  41. // return $this->mem->set($key, JsonUtil::encode($value), $ts);
  42. // }
  43. //
  44. // public function add($key, $value, $ts = 0)
  45. // {
  46. // if ($value == null || $value == "") {
  47. // return false;
  48. // }
  49. // return $this->mem->add($key, JsonUtil::encode($value), $ts);
  50. // }
  51. //
  52. // public function replace($key, $value, $ts = 0)
  53. // {
  54. // if ($value == null || $value == "") {
  55. // return false;
  56. // }
  57. // return $this->mem->replace($this->mem, $key, JsonUtil::encode($value), $ts);
  58. // }
  59. //
  60. // public function delete($key)
  61. // {
  62. // return $this->mem->delete($key);
  63. // }
  64. //
  65. // public function increment($key)
  66. // {
  67. // return $this->mem->increment($key);
  68. // }
  69. //
  70. // public function getMulti($keys)
  71. // {
  72. // $resultMulti = $this->mem->getMulti($keys);
  73. // $retArray = array();
  74. // foreach ($resultMulti as $result) {
  75. // if (!$result || $result == "" || $result == null) {
  76. // $retArray[] = null;
  77. // } else {
  78. // $retArray[] = JsonUtil::decode($result);
  79. // }
  80. // }
  81. // return $retArray;
  82. // }
  83. //
  84. // public function cas($key, $value, $ts)
  85. // {
  86. // if (!property_exists($this->keyDic, $key)) {
  87. // return false;
  88. // }
  89. // if ($value == null || $value == "") {
  90. // return false;
  91. // }
  92. // $cas_token = $this->keyDic->$key;
  93. // return $this->mem->cas($cas_token, $key, JsonUtil::encode($value), $ts);
  94. // }
  95. //
  96. // public function close()
  97. // {
  98. // return $this->mem->quit();
  99. // }
  100. //
  101. //// --> 实现抽象类的 功能
  102. // public function copy($surKey, $desKey)
  103. // {
  104. // return $this->set($desKey, $this->get($surKey));
  105. // }
  106. //
  107. // /**
  108. // *
  109. // * @deprecated since version 20160413113950 经过自己考察json_encode对数据的影响并不存在
  110. // * @param type $key
  111. // */
  112. // public function getWithoutJson($key)
  113. // {
  114. //
  115. // }
  116. //
  117. // /**
  118. // *
  119. // * @deprecated since version 20160413113950 经过自己考察json_encode对数据的影响并不存在
  120. // * @param type $key
  121. // * @param type $value
  122. // * @param type $ts
  123. // */
  124. // public function setWithoutJson($key, $value, $ts = 0)
  125. // {
  126. //
  127. // }
  128. //
  129. // public function setMutlti($dict, $expireTs = 0)
  130. // {
  131. //
  132. // }
  133. //
  134. //}