def search(pattern, redis_hash, max_keys, timeout):
    from redis_explorer.redis_manager import get_client
    #signal.signal(signal.SIGALRM, timeout_handler)
    #signal.alarm(timeout)
    list_keys = []

    try:
        client = get_client(redis_hash)
        if client:
            print client.info()
            print pattern
            #itr=client.scan_iter(pattern)
            itr = my_scan(client, match=pattern, timeout=timeout)
            print itr

            counter = 0

            for key in itr:
                list_keys.append(key)
                counter += 1
                if counter >= max_keys:
                    break
            #signal.alarm(0)
            return list_keys
        else:
            raise Exception("No Client found ! %s" % redis_hash)
    except Exception as e:
        #signal.alarm(0)
        raise e
    else:
        pass
    finally:
        pass
Esempio n. 2
0
def fetch_all_hash_values(redis_hash, key):
    from redis_explorer.redis_manager import get_client
    client = get_client(redis_hash)
    result = dict(client.hscan_iter(key))
    return result
Esempio n. 3
0
def get_key_type(key, redis_hash):
    from redis_explorer.redis_manager import get_client
    client = get_client(redis_hash)
    return client.type(key)
Esempio n. 4
0
def get_key_encoding(key, redis_hash):
    from redis_explorer.redis_manager import get_client
    client = get_client(redis_hash)
    return client.object("ENCODING", key)
Esempio n. 5
0
def fetch_string_val(redis_hash, key):
    from redis_explorer.redis_manager import get_client
    client = get_client(redis_hash)
    result = client.get(key)
    return result