php session 过期时是否可以设置 memcached 过期键?
Is possible to set a memcached expire key when php session expire?
我需要在用户 php session 过期时同时使 memcached 数组中的某些数据数组无效(过期)。我也将 memcached 用于 php session。
为什么我只是不在 $_SESSION 中存储一个数组?因为所有数据在 http header 中都是 keep/send 甚至在 ajax 中,而外部 memcached 数组并非如此。
php session 过期时可以设置内存缓存过期键吗?
你可以实施custom session handler for session_destroy.
When a session is specifically destroyed, PHP will call the destroy
handler with the session ID.
PHP will call the gc callback from time to time to expire any session
records according to the set max lifetime of a session. This routine
should delete all records from persistent storage which were last
accessed longer than the $lifetime.
在此自定义处理程序中,您可以清除内存缓存中的所有过期用户数据。
我需要在用户 php session 过期时同时使 memcached 数组中的某些数据数组无效(过期)。我也将 memcached 用于 php session。 为什么我只是不在 $_SESSION 中存储一个数组?因为所有数据在 http header 中都是 keep/send 甚至在 ajax 中,而外部 memcached 数组并非如此。 php session 过期时可以设置内存缓存过期键吗?
你可以实施custom session handler for session_destroy.
When a session is specifically destroyed, PHP will call the destroy handler with the session ID.
PHP will call the gc callback from time to time to expire any session records according to the set max lifetime of a session. This routine should delete all records from persistent storage which were last accessed longer than the $lifetime.
在此自定义处理程序中,您可以清除内存缓存中的所有过期用户数据。