public api json caching and remove n+1 query