🦠A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
The location services associated with csbs, jhu and nyt require only one instance of each to perform the necessary operation. Therefore in order to avoid wasting memory we would create only one instance of each and access it using the singleton pattern. For this end I created a class-level variable __instance__ and a method getInstance in the parent class LocationService to implement the singleton pattern. And then updated data.init.py module to use the getInstance to retrieve and return the relevant LocationService instance.
The location services associated with csbs, jhu and nyt require only one instance of each to perform the necessary operation. Therefore in order to avoid wasting memory we would create only one instance of each and access it using the singleton pattern. For this end I created a class-level variable
__instance__
and a methodgetInstance
in the parent class LocationService to implement the singleton pattern. And then updated data.init.py module to use the getInstance to retrieve and return the relevant LocationService instance.