Cache Object in PHP without using serialize

后端 未结 9 1003
眼角桃花
眼角桃花 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:41

    Look into the Igbinary PHP extension. It is a drop in replacement for serialize and unserialize and it may suit your needs.

    It stores objects in a binary format instead of a string which decreases memory usage and also decreases the time to serialize and unserialize objects.

    Although this does go through the process of unserializing an object, the binary format may increase performance enough to make this process reasonable for use in your application.

提交回复
热议问题