Welcome Guest, Not a member yet? Register   Sign In
Database connecting and caching
#1

[eluser]AlexJ[/eluser]
Hi there,

Im a pretty experienced CI developer but im wondering about the following:

When I monitor my MySQL processlist, I see that my CodeIgniter apps are connecting to the database, setting the collocation.

Right there and then, it finds out that the query is already in the cache folder, so it disconnects the fresh connection again, this takes my server alot of overhead if people are visiting a cached query at the same time.

Where do I find the code in the system folder that connects and searches the cache? CI should first check the cache, and if the query isnt in the cache, it should connect and do the query.
#2

[eluser]Gerep[/eluser]
The Database Cashing Class do that for you.

Check if your application/config/database.php
Code:
$db['default']['cache_on'] = TRUE;

And take a good look at Database Cashing Class
#3

[eluser]AlexJ[/eluser]
Thanks for your answer, however I already have caching working. I just want to change the core files so it first checks if a query is in the cache, and only if it doesn't exist in the cache, connect to the database and retrieve it
#4

[eluser]Gerep[/eluser]
The Database Cashing Class stores the files on the system/cache

Inside that folder, CI will separate the files like controller+method folder.

When you need to connect to your database, check the folder system/cache/controller+method and check is there is a file.
#5

[eluser]AlexJ[/eluser]
Im afraid your not understanding my problem, CodeIgniter first connects to the database before checking the cache, I don't want that, I want it the another way around




Theme © iAndrew 2016 - Forum software by © MyBB