We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 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.



1.9k

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



6.6k

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



1.9k

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



6.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.9k

Can you show the code of the model and controller?



6.6k
Accepted
answer

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