https://github.com/laststylebender14/slice
Slice is an in-memory, very fast, single threaded database that persists on disk.
https://github.com/laststylebender14/slice
database docker docker-compose in-memory-database kv-store python
Last synced: 3 months ago
JSON representation
Slice is an in-memory, very fast, single threaded database that persists on disk.
- Host: GitHub
- URL: https://github.com/laststylebender14/slice
- Owner: laststylebender14
- Created: 2024-03-02T12:47:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-07T08:26:36.000Z (over 2 years ago)
- Last Synced: 2025-07-23T22:10:59.465Z (12 months ago)
- Topics: database, docker, docker-compose, in-memory-database, kv-store, python
- Language: Python
- Homepage:
- Size: 127 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Slice
===
Slice is an ultra-simple, Python-based, in-memory key-value store that communicates using the RESP protocol (redis use this for communication).
```
____ _ _ ____ ____
/ ___|| (_) ___ ___ | _ \| __ )
\___ \| | |/ __/ _ \ | | | | _ \
___) | | | (_| __/ | |_| | |_) |
|____/|_|_|\___\___| |____/|____/
```
## Why should you care?
Building a database from scratch can be an exhilarating experience. With Slice, you can:
- build a database from scratch
- learn database internals, starting with Redis
- learn about advanced data structures, algorithms, and event loops (io multiplexing)
- collaborate with other engineers and contribute back to Open Source
## Why Use Slice?
While production use of Slice might not be ideal, it offers a perfect platform for:
Educational Purposes: Learn the fundamentals of key-value stores and database systems in a practical way.
Experimentation and Prototyping: Rapidly test and validate data storage concepts for small-scale projects.
Building a Foundation for Redis: Get comfortable with the RESP protocol used by Redis before diving into the full-fledged server.
## Getting Started
To run SliceDB locally, you'll need:
### Using Python
You'll need:
1. **Python 3+**
2. A supported platform environment:
- Linux-based environment
- OSX (Darwin) based environment
```
$ git clone https://github.com/ranjitmahadik/slice-db
$ cd slice-db
$ pip3 install -r requirements.txt
$ mv .example.env .env
$ python3 main.py
```
### Using Docker
You'll need:
1. **Docker**
```
$ git clone https://github.com/ranjitmahadik/slice-db
$ cd slice-db
$ mv .example.env .env
$ docker compose up -d
```
## Slice in action
Slice communicates in the Redis dialect, allowing seamless integration with any Redis client. To interact with Slice:
- Use a [Redis CLI](https://redis.io/docs/manual/cli/) for quick access.
- Programmatically connect using your preferred Redis library in the language of your choice.
**Example:**
```python
import redis
client = redis.Redis(host='localhost', port=6379)
client.set('key', 'value')
print(client.get('key')) # Output: b'value'
```
## Get Involved
Ready to dive into Slice? Join our community and contribute to the project on [GitHub](https://github.com/ranjitmahadik/slice-db). Whether you're a seasoned developer or just starting out, there's room for everyone to learn and grow together.