https://github.com/jollyboss123/pegasus
a naive java implementation of a redis server
https://github.com/jollyboss123/pegasus
java redis redis-server virtual-threads-java-21
Last synced: 5 months ago
JSON representation
a naive java implementation of a redis server
- Host: GitHub
- URL: https://github.com/jollyboss123/pegasus
- Owner: jollyboss123
- Created: 2024-04-18T06:07:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T03:31:42.000Z (almost 2 years ago)
- Last Synced: 2024-04-22T04:51:24.839Z (almost 2 years ago)
- Topics: java, redis, redis-server, virtual-threads-java-21
- Language: Java
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pegasus
pegasus is a naive Java implementation of a Redis server that can be connected to using the Jedis client.
## Installation and Setup
1. Clone the repository:
```bash
git clone https://github.com/your-username/pegasus.git
```
2. Build the project using maven:
```bash
cd j-redis
mvn clean package
```
3. Run the pegasus server
```bash
java -jar target/j-redis.jar
```
## Usage
### Using Jedis Client
You can connect to the j-redis server using the Jedis client as follows:
```java
try (Jedis jedis = new Jedis("localhost", )) {
jedis.set("hello", "world");
String value = jedis.get("hello");
jedis.get("nonexistent");
}
```
### Sending Commands Manually
Alternatively, you can send Redis commands manually:
#### Set Command
```bash
printf "*3\r\n\$3\r\nSET\r\n\$5\r\nhello\r\n\$5\r\nworld\r\n" | nc localhost
```
#### Get Command
```bash
printf "*3\r\n\$3\r\nGET\r\n\$5\r\nhello\r\n" | nc localhost
```