Multiton is a creational design pattern and very similary to the singleton pattern.Singleton pattern allow one instance of created class , Multiton map created classes with key-value pair.Collection types(key-value) provider this mapping(like Dictionary collection).
- a tracker for created objects
- the name being an integer identifier.
- When I wanted to create a limited number of intance
you can see without singleton,with singleton and multiton scenarios in following diagram.In classic screnario,It can create a new instance for each client request(new).In singleton screnario it can create a one instance for each client request.In multiton screnario it can create one with same key, more with different key for each request.
Let’s take a look at the following code:
i want to share with class diagram.
In this post I tried to explain the pattern of multiton. see you