V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
abersheeran
V2EX  ›  Python

写了一个基于 Python PEP249 的连接池

  •  
  •   abersheeran ·
    abersheeran · 2021-01-15 11:08:16 +08:00 · 1804 次点击
    这是一个创建于 1169 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/abersheeran/pep249

    昨儿一顿搜索没搜到,自己写了一个用。

    • 取、还操作均线程安全
    • 可限制最大连接数
    • 仅在需要时初始化连接

    别问,问就是摸鱼了几个小时,写了几十分钟搞定。一天工作量又有了。

    1 条回复    2021-01-16 23:24:12 +08:00
    tmackan
        1
    tmackan  
       2021-01-16 23:24:12 +08:00
    evenlet 这个库的 db_pool.py 文件有一个实现可以参考下
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5406 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 07:46 · PVG 15:46 · LAX 00:46 · JFK 03:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.