utils/factory.py: add toy version of bars caching