serialize a large array in PHP?

前端 未结 13 1946
死守一世寂寞
死守一世寂寞 2021-01-04 06:11

I am curious, is there a size limit on serialize in PHP. Would it be possible to serialize an array with 5,000 keys and values so it can be stored into a cache?

I am

相关标签:
13条回答
  • 2021-01-04 06:50

    If you want to cache it (so I assume performance is the issue), use apc_add instead to avoid the performance hit of converting it to a string + gain cache in memory.

    As stated above the only size limit is available memory.

    A few other gotchas: serialize'd data is not portable between multi-byte and single-byte character encodings. PHP5 classes include NUL bytes that can cause havoc with code that doesn't expect them.

    0 讨论(0)
提交回复
热议问题