Message277587
> Perhaps: _cache.pop(next(iter(_cache)))
This can raise KeyError if the cache is cleared in other thread. And it is a little slower.
I remember why I didn't propose this idea earlier. This depends on the ordering of dict. But this is implementation detail, and in other Python implementation this can cause recompiling two interchangeably used regexes. No, this no longer LGTM.
Maybe use OrderedDict? But this adds heavy dependency to the re module.
Yet one idea: use two caches. Look first in the one cache, then in the other. When the first cache full, clear the second cache and swap caches. |
|
Date |
User |
Action |
Args |
2016-09-28 06:01:35 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, xiang.zhang |
2016-09-28 06:01:35 | serhiy.storchaka | set | messageid: <1475042495.84.0.55615946256.issue28293@psf.upfronthosting.co.za> |
2016-09-28 06:01:35 | serhiy.storchaka | link | issue28293 messages |
2016-09-28 06:01:35 | serhiy.storchaka | create | |
|