C implementation of Python lru_cache