mò Š%ÜGc@sudkZdkZdkZdkZdkZdkZdkZdk l Z dZ d„Z de fd„ƒYZ dS(N(s spyceModules3Pool module supports the creation of server-pooled objects. The single pool is shared among all Spyce execution context residing on a given server, and remains until the server dies. It is often useful to store database connections, and other variables that are expensive to compute on a per-request basis. cCstiitiƒiidƒS(Nsspypool.pickle(tostpathtjointspycet getServertconfigttmp(((t0/home/holguin2/public_html/spyce/modules/pool.pyt picklefilestpoolcBsttZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( Ncsötiƒiƒo|iiƒ|_dSnyttƒdƒ‰Wn t j oh|_dSnX‡d†}t i |ƒp d‚nzKytiˆƒ|_Wn.tj o"t_tidƒh|_nXWdtiˆƒˆiƒXdS(sDefine or retrieve the pool.NtrbcstiˆtitiBƒtS(N(t spyceLockt file_locktftLOCK_SHtLOCK_NBtTrue((R (Rtfoo%ss)timeout opening pool pickle file for readsËWarning: unable to complete loading pool from pickle file. A common cause is adding instances of custom classes to the pool. Consider using Spyce in standalone mode to avoid pickle-related limitations.(RRtthreadedtselft_apitgetServerGlobalst_pooltopenRR tIOErrorRt spyceUtilt tryForAwhiletpickletloadtEOFErrortUnpicklingErrortDEBUGR t file_unlocktclose(RR R((R Rtstarts*      csŒtiƒiƒodSnttƒdƒ‰‡d†}ti|ƒp d‚nzt i |i ˆdƒWdt iˆƒˆiƒXdS(NtwbcstiˆtitiBƒtS(N(R R R tLOCK_EXRR((R (RR7ss*timeout opening pool pickle file for writeiÿÿÿÿ(RRRRRR RRRRtdumpRRR R R!(RterrR R((R Rtfinish3s   cCs |i|S(sGet an item from the pool.N(RRtkey(RR(((Rt __getitem__AscCs||i|