Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created June 10, 2014 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shin1x1/778053e67fe948d215f2 to your computer and use it in GitHub Desktop.
Save shin1x1/778053e67fe948d215f2 to your computer and use it in GitHub Desktop.
<?php
// session
ini_set('session.save_handler','memcached');
ini_set('session.save_path','PERSISTENT=abc localhost:11211');
//ini_set('session.save_path','localhost:11211');
ini_set('memcached.sess_consistent_hash', '1');
session_start();
if (empty($_SESSION['count'])) {
$_SESSION['count'] = 0;
}
$_SESSION['count']++;
var_dump($_SESSION);
// application
$memcahed = new Memcached('abc');
if (!$memcahed->getServerList()) {
$memcahed->addServer('localhost', 11211);
}
var_dump($memcahed->get('date'));
$memcahed->set('date', date('Y/m/d H:i:s'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment