logcache: make sure cache does not exceed memory

Signed-off-by: Sven Nierlein <sven@nierlein.de>