Implement functionality to clear memory caches

Signed-off-by: Simon Busch <morphis@gravedo.de>