cache_memcache.class.php 633 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class cache_memcache {
  3. private $memcache = null;
  4. public function __construct() {
  5. $this->memcache = new Memcache;
  6. $this->memcache->connect(MEMCACHE_HOST, MEMCACHE_PORT, MEMCACHE_TIMEOUT);
  7. }
  8. public function memcache() {
  9. $this->__construct();
  10. }
  11. public function get($name) {
  12. $value = $this->memcache->get($name);
  13. return $value;
  14. }
  15. public function set($name, $value, $ttl = 0, $ext1='', $ext2='') {
  16. return $this->memcache->set($name, $value, false, $ttl);
  17. }
  18. public function delete($name) {
  19. return $this->memcache->delete($name);
  20. }
  21. public function flush() {
  22. return $this->memcache->flush();
  23. }
  24. }
  25. ?>