An asset is a piece of data or another type of resource that is not-so-easy to acquire (e.g. memory size or time of creation) and it feels like unnecessary create/destroy cycles may hurt the application performance.
AssetManager tracks a number of requests per given asset and it will only dispose an asset when the number of requests drops to zero, possibly with a little delay - it may help if an asset is acquired shortly after it was disposed.
Please note that AssetManager is not the same as Cache. The latter is more about collecting "static" data (e.g. redis). But an asset may also be a dynamic object, e.g. a WebSocket connection.
Anyway, although it seems like it's something very typical I was not able to find neither a description nor standard implementation of this pattern. Maybe I am just using a wrong name.
I am aware people are using a lot of this technique, e.g. in games development so it's not anything original. But in terms of design patterns themselves the closest I could get was the flyweight pattern. So I started to wondering if AssetManager has ever been recognized as a separated design pattern. I will be grateful for any clues on this topic.
Aucun commentaire:
Enregistrer un commentaire