Add caching result of functions which operates on request

SQL optimizations

Change-Id: Ib2a382814d61b8cd4a4774629d2819ae398c1b19