Implemented singleton to allow shared memory between sessions
Browse files
postly/clients/singleton_client.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .postly_client import PostlyClient
|
| 2 |
+
|
| 3 |
+
class SingletonPostlyClient:
|
| 4 |
+
_instance = None
|
| 5 |
+
|
| 6 |
+
@staticmethod
|
| 7 |
+
def get_instance():
|
| 8 |
+
if SingletonPostlyClient._instance is None:
|
| 9 |
+
SingletonPostlyClient._instance = PostlyClient()
|
| 10 |
+
return SingletonPostlyClient._instance
|