# Firefly Database

Firefly is a high-performance, Redis-compatible key-value store optimized for gaming applications. Built with native AOT compilation support for maximum performance.

## Features

- **Redis-Compatible**: Uses Redis Serialization Protocol (RESP) for compatibility with Redis clients
- **Concurrent Data Structures**: Uses parallel data structures for high throughput and low latency
- **Sharded Architecture**: Distributes data across multiple shards to reduce contention
- **Password Authentication**: Optional password protection for secure deployments
- **Native AOT Support**: Fully compatible with .NET Native AOT for maximum performance
- **Automatic Backups**: Configurable backup system with rotation
- **Multi-Datatype Support**: Strings, Lists and Hash Maps support

## Quick Start

```bash
# Start server with default settings
firefly

# Start with password authentication
firefly --password yourSecretPassword

# Start with custom port
firefly --port 6380
```

## Authentication

When starting Firefly with password protection, clients must authenticate:

```
AUTH yourSecretPassword
```

For more details on how to use authentication with different clients, see the [USAGE.md](USAGE.md) file.

## Building from Source

### Prerequisites
- .NET 9.0 SDK or later

### Build Commands
```bash
# Standard build
dotnet build

# Release build
dotnet build -c Release

# Native AOT build (Windows x64)
dotnet publish -c Release -r win-x64 --self-contained -p:PublishAot=true

# Native AOT build (Linux x64)
dotnet publish -c Release -r linux-x64 --self-contained -p:PublishAot=true
```

## Performance Benchmarks

The benchmark mode (`--benchmark`) runs a series of concurrent operations to test throughput:

```bash
firefly --benchmark
```

Typical results on modern hardware:
- ~500,000 operations per second for simple key-value operations
- ~250,000 operations per second for list operations
- ~150,000 operations per second for hash map operations

## License

MIT

## See Also

- [USAGE.md](USAGE.md) - Detailed usage instructions
- [ArmaFireflyClient](https://gitea.innovativedevsolutions.org/IDSolutions/ArmaFireflyClient/) - Arma 3 extension client 