Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2. // Test default memcached server. Load, then refresh.
  3. if (class_exists('Memcache')) {
  4. $meminstance = new Memcache();
  5. } else {
  6. $meminstance = new Memcached();
  7. }
  8.  
  9. $meminstance->addServer("127.0.0.1",11211);
  10.  
  11. $result = $meminstance->get("test");
  12.  
  13. if ($result) {
  14. echo $result;
  15. } else {
  16. echo "No matching key found. Refresh the browser to add it!";
  17. $meminstance->set("test", "Successfully retrieved the data!") or die("Couldn't save anything to memcached...");
  18. }
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement