lundi 27 juillet 2015

Design pattern suggestion for storing the client information in map in server application

My application is server, and my client will give some request for processing. Client will contact me(server) for multiple times for handling the same request .

map<clientId,ClientInformation>

Usually i will store some information which i received from the client in STL Map for processing the client request next time.

Once client was satisfied in my servings, i will clear the entry in the map for the respective client Id.

This is my sample ClientInformation class

class ClientInformation
{
int NotRequiredForNextTime;  // Information Not required for  processing the client request next time
int requiredforNextTime;  // Information required for  processing the client request next time
int requiredforNextTime;  // Information required for  processing the client request next time
int NotRequiredForNextTime;  // Information Not required for  processing the client request next time
int NotRequiredForNextTime;  // Information Not required for  processing the client request next time

UserDefinedClass Class1;
};

Class UserDefinedClass
{
int requiredforNextTime;
int NotRequiredForNextTime;
}

In the above class, i require only requiredforNextTime to be stored in the map. other information is required only at the time of processing the current request. ClientInformation class can have userdefined class as member(UserDefinedClass), and some of the UserDefinedClass members are not required for next time.

Is there is any design pattern, which provided optimized solution for this problem.

Aucun commentaire:

Enregistrer un commentaire