Cache sql queries