锟斤拷装锟斤拷 PECL 锟斤拷展锟斤拷氐锟斤拷锟较拷锟斤拷锟斤拷植锟斤拷斜锟斤拷锟轿� PECL 锟斤拷展锟侥帮拷装锟铰斤拷锟斤拷锟揭碉拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷锟铰的凤拷锟叫版本锟斤拷锟斤拷锟截★拷源锟侥硷拷锟斤拷 维锟斤拷锟斤拷员锟斤拷息锟斤拷锟斤拷锟斤拷锟街撅拷龋锟斤拷锟斤拷诖舜锟斤拷锟� » https://pecl.php.net/package/tokyo_tyrant
The extension can be enabled by adding extension=tokyo_tyrant.so to the INI-configuration
ttserver -port 2000 -ext /path/to/expire.lua -extpc expire 30.0 '/tmp/sessions.tct#idx=ts:dec'
Note: expire.lua is included in the tokyo_tyrant extension source distribution
Note: It is important to make sure that tokyo_tyrant.session_salt matches on all servers.
The session handler creates a session id like the following: 8b0e27a823fa4a6cf7246945b82c1d51-a5eadbbed1f2075952900628456bfd6830541629-0-5460
The parts from left to right:
The checksum contains SHA1 sum of the node id, primary key, session id and the salt which is known only on the server side. This allows quick mapping of session id to node and primary key since there is no need to do an additional search. During session id regeneration only the parts 1 and 2 change but the mapping to the node and primary key stays constant.
In case some of the nodes fail tokyo_tyrant.allow_failover, tokyo_tyrant.fail_threshold and tokyo_tyrant.health_check_divisor INI-settings control the behavior during failover. If failover is allowed the session handler will map the session to a healthy node and creates a new empty session.