🇨🇳🐲🎉 本网站的中文版本尚处早期开发阶段。如果您发现其中存在错字、纰漏或其他任何问题,请随时联系 [email protected] 向我反馈。
享元

享元在 Swift 中的实现

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.

Learn more about Flyweight

在 Swift 中使用模式

Complexity: High

Popularity: Very low

Usage examples: The Flyweight pattern has a single purpose: minimizing memory intake. If your program doesn't struggle with a shortage of RAM, then you might just ignore this pattern for a while.

Identification: Flyweight can be recognized by a creation method that returns cached objects instead of creating new.

享元在其他编程语言中的实现

享元 在 Java 中的实现 享元 在 C# 中的实现 享元 在 PHP 中的实现 享元 在 Python 中的实现 享元 在 Ruby 中的实现 享元 在 TypeScript 中的实现