2016-12-09から1日間の記事一覧

pylruをマルチスレッドで使うと「KeyError:」が発生する

githubにissueがないのでここに書く。 以下のような2スレッドで同時にlrucacheに書き込むとエラーが起きる。 test.py import pylru import threading import random cache = pylru.lrucache(1024) def f(): while True: key = 'key %s' % (random.randint(1,…