享元在 PHP 中的实现
Flyweight is a structural design pattern that allows programs to support vast quantities of objects by keeping their memory consumption low.
Pattern achieves it by sharing parts of object state between multiple objects. In other words, the Flyweight saves RAM by caching the same data used by different objects.
在 PHP 中使用模式
Popularity: Very low
Usage examples: The Flyweight pattern is especially rarely used in PHP applications due to the very nature of the language. A PHP script typically works with a part of the application's data and never loads all of it into the memory at the same time.