fix Cache::get(): return value even if not value object
Extract ttl (time-to-live handling) to separate class.