Count and limit the number of users on my app
问题 I need to implement a system to limit the number of users that can concurrently use my app. I am thinking the best way to go is to count the number of sessions currently active and then limit based on that. How can I count the number of sessions currently active. I am using memcached to store my sessions if that makes a difference 回答1: I think the easiest way is to intercept the session's open , destroy and gc callbacks (using session_set_save_handler()) and increment/decrement a session