lundi 5 août 2019

Which design pattern to use to avoid duplicate data and sending same request again and again?

There are two classes class A and class B, and both the classes are using same data and I am using HTTP request to get the data. Now since both the classes are using same data i can make use of inheritance and consume the data. But every time i create the instance of class A its sending request to server and same thing happens with class B. Instead of sending two request, Is there any design that I can send one request and when ever I create the object of class A or class B same data will be used without sending new request?

Aucun commentaire:

Enregistrer un commentaire