python中单例在什么情景下使用?
巴扎黑
巴扎黑 2017-04-17 17:52:39
0
2
381

我知道在频繁使用一个类时可以使用单例模式,但在python web开发中具体什么场景呢

巴扎黑
巴扎黑

reply all(2)
巴扎黑

Single cases are generally used in situations like connections. The scenario where I used singletons in python web before was that the python web service needed to connect to another service and needed to register and log in. At this time, if a singleton was not used, every client would send a request to that server through the web program. The service registers and logs in. After using the singleton, all clients only register and log in once with another service through the web, and then use this connection repeatedly until the connection expires.

洪涛

Logging is a singleton

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template