Skip to content

RedisManager

Jordan Samhi edited this page Oct 23, 2026 · 2 revisions

RedisManager

com.jordansamhi.androspecter.network.RedisManager wraps a Jedis connection for optional queue and result-storage workflows. It is not needed for local APK analysis. The caller owns the connection and should close it with try-with-resources.

This method-body snippet connects to a local Redis instance and uses an example key; run it only against the Redis service and namespace you intend to modify:

import com.jordansamhi.androspecter.network.RedisManager;

try (RedisManager redis = new RedisManager("localhost", "6379",
        System.getenv("REDIS_PASSWORD"))) {
    redis.sadd("my-analysis:pop", "replace-with-a-real-apk-sha256");
    System.out.println(redis.scard("my-analysis:pop"));
}

The constructor requires server and port strings. Authentication is omitted when its third argument is null or empty. There is no public no-argument constructor. Connection or authentication failures propagate as exceptions.

Operations Purpose
lpush, llen, lrange, lrem Add, inspect, and remove list entries
sadd, spop, sismember, scard, smembers Add, consume, and inspect set members
set, get, del Store, read, and delete values

spop consumes a random set member; it is not a peek. Missing values can return null. lrange(key, 0, -1) reads the whole list. lrem uses Redis count semantics: positive counts remove from the head, negative from the tail, and zero removes all matches.

lpush, sadd, and set also accept byte arrays; their string keys are encoded as UTF-8. The string read methods do not provide a general binary round trip. Do not share one manager concurrently across threads. See AndroidAppsProcessor for the worker's set names and lifecycle.

Clone this wiki locally