Reputation: 965
I have a table that contains the information about the current location(lat,lng) of user and from my php script i will query the table to find the other users that are surrounding him within some distant(like 50Miles). And each of the=is query may result large data set.
The above query is executed more in my app. But I know that the result contains same data for a user at least for 5 mins.
If i cache the sql query for 5 mins for particular user then i can read from cache instead of querying. After 5 mins i have to query the table as the other users location get updated.
How to solve the above situation ? Any caching techniques for php and mysql ?
Thanks, Seshachalam M
Upvotes: 0
Views: 361
Reputation: 7475
There is an option for query caching in application/config/database.php
, Change the following lines.
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
In addition to this you can also see:
1. How to use memcached from codeigniter
2. http://ellislab.com/codeigniter/user-guide/libraries/caching.html
Upvotes: 1