This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka, xiang.zhang
Date 2016-09-28.06:01:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1475042495.84.0.55615946256.issue28293@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2016-09-28 06:01:35serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, xiang.zhang
2016-09-28 06:01:35serhiy.storchakasetmessageid: <1475042495.84.0.55615946256.issue28293@psf.upfronthosting.co.za>
2016-09-28 06:01:35serhiy.storchakalinkissue28293 messages
2016-09-28 06:01:35serhiy.storchakacreate