Using Setglobalstate To Store A Long String.

I have to generate a long string (few thousand chars) whenever my app start and i would like to re-use this string. Is storing this string with setGlobalState for re-use later a good practise performance wise?

Yii stores global states in runtime/state.bin by default. If you enable a cache component, it will automatically cache the file contents. So it should be fairly quick performance wise.

My app will be hosted on shared hosting so cache component most likely will not be able to run.

I guess using setGlobalState is still better than regenerating the string on demand…

CFileCache will certainly run nonetheless. If there will be a performance benefit in this case is rather unlikely, though.