Cache Object in PHP without using serialize

后端 未结 9 999
眼角桃花
眼角桃花 2020-12-14 12:26

I have a complex object that I create in a PHP script. I am looking for a way to store this object such that subsequent requests do not have to recreate it, or spend time un

9条回答
  •  隐瞒了意图╮
    2020-12-14 12:54

    Maybe the solution is to not build a single, massive, expensive object.

    Given that a PHP application pretty much starts from a clean slate on every page load, a solution that depends on a single, giant object is a poor fit to the language. Since you don't go into much detail about what your object is & what it does, I can't be certain, but I'd suspect you don't really need everything the object does on every page load. If that's the case, you might seriously consider splitting it into a number of smaller, simpler classes that you can instantiate as needed.

提交回复
热议问题