Thinking Piece of Cake 🍰
Today I’m ready to add a feature which is caching HOOLAY.cn
index page . You know that web page service powered by Phalcon .
Why it ? Maybe Phalcon
is highly decoupled
? C
extension ? Full Stack
framework ? …balala
Actually i just want to solve my problem . Aha . so i did these code as below .
|
|
Are you kidding me ? It’s not working , but official docs as it is ! So my first thought is debugging by Breakpoints to know cache
how to work .
You know i can’t do this . These all be compiled ! Or any ?Trace
tools could help me ? No . Read the Fucking Source !
Absolutely i need to check out View Component. Then i found something .
phalcon/mvc/view.zep
|
|
You can see pivotal code above . There is a level
option . We did not settle it & if renderLevel < cacheLevel
Cache won’t be started ! So we need set cacheLevel less than or equal renderLevel . Codes as below :
|
|
Yep . The problem was solved and an issue was associated 🍰 . But something not finished for me . I drawn a diagram about web application request flow :
PS:oh… Where is “middleware” ? Everything is “middleware” when it on a line ? That Is Really Important ?
I am thinking the Phalcon View
Component how to render & cache these view fragments . So i got these fake code (Just Logic) below .
|
|
Done . That’s all :)