开发者

Zend Auth locked session

i nearly frustrated with how Zend handling session.

here is my case. i write a auth plugin that always check the the user credential utilize Zend_Auth. and when invoke hasIdentit开发者_如何学Pythony function from zend auth, it will automatically start the session.

and the problem come when i have a long process that i need to execute. the session will lock the request until request completed. i try to release the lock by invoke Zend_Session::writeClose(false), so another request can be executed. but no way for me to start the session again.

is it a bad implementation if i try to resume stoped session?

there is only one session from the start until request execution ended?

thanks.

ps : i can do a little hack here. at the end of auth plugin i write a native php function (session_write_close) and if any controller need to use session again, i start it again with (session_start).


The easiest solution to this problem is to use a database for session storage. No file locks to worry about (as ArneRie mentined).

Option 1

Use a common PHP extension and a tiny tweak to php.ini:

You can store them on a NFS export or recode the session_set_save_handler using a SQL backend for example. But there is no solution more efficient, more scalable, more performant and easier to deploy than using memcached…

Tutorial: http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/

Option 2

The Zend way, through Zend_Session_SaveHandler_DbTable.

Examples: Zend - Storing Session data in a database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜