psycopg2/lib/compat.py
Daniele Varrazzo 35ec7ad9c1 Use a proper LRU cache for namedtuples
Previous one didn't refresh by last use. Use the stdlib version for py3
and one of our own for py2.

Max size set to 512, which should be fine for everyone (tweaking is
still possible by monkeypatching, as the tests do, but I don't want to
make an interface of it).
2019-02-02 19:29:20 +00:00

16 lines
305 B
Python

import sys
__all__ = ['string_types', 'text_type', 'lru_cache']
if sys.version_info[0] == 2:
# Python 2
string_types = basestring,
text_type = unicode
from ._lru_cache import lru_cache
else:
# Python 3
string_types = str,
text_type = str
from functools import lru_cache