sqlitecache: implement history caching