implement cache_function to easily cache return values of functions

Signed-off-by: Florian Pritz <bluewind@xinu.at>
cache file/thumbnail responses

Signed-off-by: Florian Pritz <bluewind@xinu.at>
use cache_function() everywhere

Signed-off-by: Florian Pritz <bluewind@xinu.at>