pegasus is a naive Java implementation of a Redis server that can be connected to using the Jedis client.
-
Clone the repository:
git clone https://github.com/your-username/pegasus.git
-
Build the project using maven:
cd j-redis mvn clean package
-
Run the pegasus server
java -jar target/j-redis.jar
You can connect to the j-redis server using the Jedis client as follows:
try (Jedis jedis = new Jedis("localhost", <port>)) {
jedis.set("hello", "world");
String value = jedis.get("hello");
jedis.get("nonexistent");
}
Alternatively, you can send Redis commands manually:
printf "*3\r\n\$3\r\nSET\r\n\$5\r\nhello\r\n\$5\r\nworld\r\n" | nc localhost <port>
printf "*3\r\n\$3\r\nGET\r\n\$5\r\nhello\r\n" | nc localhost <port>