https://refactoring.guru/design-patterns/flyweight
Flyweight
/ Design Patterns / Structural Patterns Flyweight Also known as: Cache Intent Flyweight is a structural design pattern that lets you fit more objects into the available amount of RAM by sharing common parts of state between multiple objects instead of keep
refactoring.guru
자원의 효율적 사용을 위해 특정 키를 부여하고 이 키를 통해 자원을 캐싱 하고자 할때.
예시
- TextureCacheManager
- AssetManager
예제 코드
더보기
class BundleLoader
{
public void Load() { }
}
class AssetBundle
{
}
class AssetBundleMng
{
Dictionary<string, AssetBundle> _dictBundles;
AssetBundle GetBundle(string name)
{
return _dictBundles[name];
}
}
internal class FlightWeight
{
}
'Work & Programming > System Design' 카테고리의 다른 글
[Behavioral Pattern] - Chain Of Responsibility (0) | 2024.05.16 |
---|---|
[Structural Pattern] - Proxy (0) | 2024.05.15 |
[Structural Pattern] - Facade (0) | 2024.05.15 |
[Structural Pattern] - Decorator (0) | 2024.05.15 |
[Structural Pattern] - Composite (0) | 2024.05.15 |