高性能 Python 内存缓存: Theine - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
matrix1010

高性能 Python 内存缓存: Theine

  •  
  •   matrix1010
    Yiling-J Feb 10, 2023 3648 views
    This topic created in 1175 days ago, the information mentioned may be changed or developed.

    前段时间开源了 Python 的异步缓存框架 Cacheme ,现在把其中的内存缓存部分单独抽出来作为一个 library ,有兴趣的可以试用一下.

    Theine: https://github.com/Yiling-J/theine

    Benchmarks: https://github.com/Yiling-J/cacheme-benchmark

    类似于Caffeine(Java)/Ristretto(Go)/Moka(Rust),具有以下特点:

    • 高性能,核心数据结构(W-TinyLFU, timer wheel)使用 Rust 编写
    • W-TinyLFU 缓存驱逐策略,流量倾斜度高的情况下有很好的命中率
    • 通过 hierarchical timer wheel 定期自动删除过期缓存
    4 replies    2023-02-15 17:25:19 +08:00
    Nazz
        1
    Nazz  
       Feb 10, 2023 via Android
    我也写过一个内存缓存库,使用 hashmap 和 heap 实现 ttl
    matrix1010
        2
    matrix1010  
    OP
       Feb 10, 2023
    @Nazz heap 也可以,似乎 Go 自带的 timer 就是通过 heap 实现的
    matrix1010
        3
    matrix1010  
    OP
       Feb 10, 2023
    有兴趣的也可以看看我在 reddit 上发的这个帖子: https://www.reddit.com/r/Python/comments/10xnpjh/python_deserves_a_good_inmemory_cache_library/
    mongodb
        4
    mongodb  
       Feb 15, 2023
    很好,不用啥都塞 redis 了。
    About     Help     Advertise     Blog     API     FAQ     Solana     2777 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 40ms UTC 14:03 PVG 22:03 LAX 07:03 JFK 10:03
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86