def cache_search(cache: list, key: str, val: str):
    """
    search a key with value in the given cache

    @Args:
    * [cache] the cache list, which probably comes from database or redis-like cache
    * [key] the key contains in every row of cache
    * [val] the value that matches to the given val
    """
    if cache and isinstance(cache, list):
        if key not in cache[0].keys():
            return None
        for row in cache:
            if row[key] == val:
                return row
    return None
