I'm running moodle 3.1.3. I have memcached set up for sessions.
It's set up in my config.php file:
// Section for handling the session memcached server
$CFG->session_handler_class = '\core\session\memcached';
$CFG->session_memcached_save_path = 'xxx.xxx.xxx.xxx:11212';
$CFG->session_memcached_prefix = 'mdl.memc.sess.key.';
$CFG->session_memcached_acquire_lock_timeout = 120;
$CFG->session_memcached_lock_expire = 7200;
I'm also using memcache for applications as well, which is why sessions are using port 11212.
I can confirm that this works, because if memcache is not running on the memcache server, or if I put another IP address or, another port number, I can't log into moodle, with moodle complaining about session handler not being set up.
I also can see the status of the memcache server changing by looking at the STATS command, I see data coming in and being set, etc.
However -- I also see files in my moodle_data/sessions directory! Right now, I see 160 of them. This confuses me, as it seems that when I setup memcached for sessions a year ago - I saw nothing in this directory. Now, I see stuff all the time.
When I look in the "Cache Administration" screen - under the "Installed Cache Stores" section I see:
[ Section Header Line ] Plugin : Ready : Stores: Modes : Supports
Session Cache: Green Checkmark: 1: Session: data guarantee, ttl, key awareness
When I look under "Configured Store Instances" (same screen as above) I see:
[ Section Header Line ] Store Name: Plugin : Ready: Store Mappings : Modes: Supports: Locking
Default session store for session caches: Session cache: Green Checkmark: 0 : Session: data guarantee, ttl, key awareness, searching by key: Default file locking
I would swear that this is what it looked like originally - meaning that it was really hard to tell from within the application that memcached was being used for sessions - presumably because you could only set it up and configure it from the config.php file. But memories can fail me, and maybe I'm wrong.
To summarize, It both appears (via logging in only working when memcached is running and setup properly with correct IPs and port numbers, as well as watching stats in the memcache server) that memcache is working and correctly for sessions, however, I'm ALSO seeing actively changing files in the moodle_data/sessions directory. It almost seems that I have sessions configured and not configured to use memcache, just looking at the evidence.
Can anyone PLEASE tell me if this looks normal, and if not, what can I start reviewing to address it?