Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Model must connect the db?

If I use the model, it will be sure to link to the database.

I used the model, and did the cache, but I found that even if the cache is present, it will connect to the database.



1.7k

It is probaly becasue of MetaData adapter which is set by default to memory. Try to change also it to like memcache adapter1



2.6k

I have change to Phalcon\Mvc\Model\MetaData\Files . But connect to database also.



1.7k

Each time or just first time? How do you checking for connections and queries to the database?



2.6k
edited Aug '16

Each time need to connect to the database.

That is a login page, do not need to connect to the database.

but call the model's method , the method read file cache.

I test by closing and opening the database server.

Can normally display the two time.

But close the database, the need for a long time, it should be to try to connect to the database, so the response is so slow.



1.7k

Can you show the code of the model and controller?



2.6k
Accepted
answer

I found that there was a logical error in my code, and the size of the cache keys was not consistent.