Re: [PHP] Help on caching an object.
> My problem is very simple: > I have an object that's definately called with every page request. > It's pretty much the same for every unregistered/anonymous user. > And it's not small. Alot of attributes are being set from DB queries etc. > > Now my idea was to do some sort of caching with PHP to speed things up. > So I was wondering if anybody had experiences on this ... > > Of course, I considered using serialize(), but it seemed to me as if > it could cause even more lagging since PHP requires the class to > unserialize the object correctly. Then I would end up reading the > class file, reading the searialized object and unserializing it. A 100 > simple DB queries might be done in the same time or at least not much > slower. > > Could it be that I'm looking at the wrong place? Should it be more > like caching the queries or something similar? > > Thank you very much for everyone's effort in advance. > > serialize is much faster than getting data from database. i use this approach to unload DB usage and it made big difference. it would be much more faster if serialized object is saved onto ram using xcache or similar. Virgil http://www.jampmark.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on caching an object.
Emailing me directly is not cheap, please don't do it again without expecting an invoice. 2009/2/11 faisal murad : > how can i unsubscribe from php list. It's really difficult. You follow the instructions shown at the end of each frickin' email!! >> To unsubscribe, visit: http://www.php.net/unsub.php Yup, that's really hard!! -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on caching an object.
2009/2/11 Yeti : > Hello gang, > > First of all, yes I searched the mailing list's archive. > > My problem is very simple: > I have an object that's definately called with every page request. > It's pretty much the same for every unregistered/anonymous user. > And it's not small. Alot of attributes are being set from DB queries etc. > > Now my idea was to do some sort of caching with PHP to speed things up. > So I was wondering if anybody had experiences on this ... > > Of course, I considered using serialize(), but it seemed to me as if > it could cause even more lagging since PHP requires the class to > unserialize the object correctly. Then I would end up reading the > class file, reading the searialized object and unserializing it. A 100 > simple DB queries might be done in the same time or at least not much > slower. > > Could it be that I'm looking at the wrong place? Should it be more > like caching the queries or something similar? > > Thank you very much for everyone's effort in advance. I suggest you look at memcached - it's an in-memory volatile cache that performs extremely well. APC has a similar feature but I've never used it. Also, are you guestimating the performance of DB queries against a serialised file? Do some tests and you might be surprised at how quickly PHP can unserialise data. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help on caching an object.
Hello gang, First of all, yes I searched the mailing list's archive. My problem is very simple: I have an object that's definately called with every page request. It's pretty much the same for every unregistered/anonymous user. And it's not small. Alot of attributes are being set from DB queries etc. Now my idea was to do some sort of caching with PHP to speed things up. So I was wondering if anybody had experiences on this ... Of course, I considered using serialize(), but it seemed to me as if it could cause even more lagging since PHP requires the class to unserialize the object correctly. Then I would end up reading the class file, reading the searialized object and unserializing it. A 100 simple DB queries might be done in the same time or at least not much slower. Could it be that I'm looking at the wrong place? Should it be more like caching the queries or something similar? Thank you very much for everyone's effort in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php