downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Memcached> <Fonctions de rappel sur clé absente
[edit] Last updated: Fri, 10 Feb 2012

view this page in

Support des sessions

Memcached fournit un gestionnaire de sessions qui peut être utilisé pour stocker les sessions sur memcache. Une instance distincte de memcached est utilisé en interne, ce qui fait que vous pouvez avoir un pool de serveur différent, si nécessaire. Les clés de sessions sont stockés avec le préfixe memc.sess.key., alors soyez-en conscient si vous utilisez le même serveur pour les sessions et pour le cache.

session.save_handler string

Donnez-lui la valeur de memcached pour activer le support des sessions sur memcached.

session.save_path string

Définit une liste de valeurs séparés par des virgules, avec la syntaxe nomdhote:port, à utiliser pour le pool de serveurs de sessions. Par exemple, "sess1:11211, sess2:11211".



Memcached> <Fonctions de rappel sur clé absente
[edit] Last updated: Fri, 10 Feb 2012
 
add a note add a note User Contributed Notes Support des sessions
sstratton at php dot net 14-Jun-2011 12:48
While the previous poster has a point that Memcached can and will cleanup to make room for it's keys, the likelihood of active sessions (due to the likelihood that they will be written to again within 30 seconds) is fairly low provided you have your memory allocation properly alloted.
Tobias 17-Feb-2011 07:35
You probably don't want to use Memcache, Memcached or anything else similar for storing sessions (in RAM via memcached daemon server), because those sessions can easily be thrown away/discarded, become unreachable for various reasons, and then your user gets logged out without warning.

What memcache is great for, in general, is storing the results of an SQL or MongoDB query, using the md5() has of the query itself as the key lookup.

For example, for all database queries, get the md5() hash of the query, then look for that key in memcache.  If it's found, great, grab the results, check they're not too old / outdated, and use them if okay.  Otherwise, pass through the query to underlying storage-based DB, then save its results into memcache before passing them back to your app.

This general applicability of how, when, where and why to use memcache to greatest advantage and least pain isn't so easy to find on the web.

Memcached module is great for new features, etc. (except now it's almost one year since update) but it's difficult to tell when a memcached daemon goes away, crashes, becomes unreachable.

Memcache at least has ->connect() method which will report failure/unreachability, but its features are behind.

These two projects are moving targets, competing, and it would be nice to get both together, so we can all benefit from best efforts.  Meanwhile, what a mess, and what a charm!
nfoo at naver dot com 28-Aug-2010 12:15
If you want to use 'memcacheD' extention not 'memcache' (there are two diffrent extentions) for session control,  you should pay attention to modify php.ini

Most web resource from google is based on memcache because It's earlier version than memcacheD. They will say as following

session.save_handler = memcache
session.save_path = "tcp://localhost:11211"

But it's not valid when it comes to memcacheD

you should modify php.ini like that

session.save_handler = memcached
session.save_path = "localhost:11211"

Look, there is no protocol indentifier
Andrei Darashenka 27-May-2009 07:56
This extension supports Session-locking!

by default
MEMC_SESS_LOCK_ATTEMPTS   30
MEMC_SESS_LOCK_WAIT       100000
MEMC_SESS_LOCK_EXPIRATION 30

 
show source | credits | sitemap | contact | advertising | mirror sites