Hello,

Alawi wrote:
> 
> now who can help me about cach my query every certain time:(
> I mean the first user requst the page and php will run query for this first time
> 
> after that I want other user to have the result that the first user have it !!
> 
> untill the ten minutes end I want the query to run again
> 
> this advantge is available in asp and JSP & ColdFusion but not available in PHP why ?

That is a new thing and is not necessarily a good thing.

The reason because it does not exist in PHP is because you need to use a
abstraction layer like JDBC or ODBC so you don't have to provide caching
engines for each type of database.

Anyway, in general it is not a good idea to cache result sets of
arbitrary sizes because the time you take to save and load the cache the
data may not be worth it.

Usually it is better to cache the pages generated with the data from the
query.

Anyway, if you still insist on caching your queries to realize that is
not worthy, I recommend two things:

1) Only cache up to a limited number of initial result set rows (say no
more than 2 pages, ie, 20 rows).

2) Use a cache engine that is atomic, ie, it will not let itself
overwrite the same cached data by multiple concurrent accesses.

You may want to try this generic data cache class that stores cached
data in files and uses locks to prevent cache corruption. It is very
well documented and comes with an example of usage in the documentation
page.

http://phpclasses.upperdesign.com/browse.html/package/313

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to