We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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.


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


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


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

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.


Can you show the code of the model and controller?


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