Database & Redis
Setting up database backends and multi-server synchronization.
Database Backends
mineWallet supports three database backends. Choose one based on your deployment needs.
H2 (Default)
An embedded database that requires no external setup. Data is stored locally on the server.
database:
databaseType: H2
Best for: single-server setups, testing, and small communities.
MySQL
A full relational database for production multi-server deployments.
database:
databaseType: MYSQL
hostname: "localhost"
base: "minewallet"
port: 3306
username: "root"
password: "securepass"
| Option | Description |
|---|---|
hostname | MySQL server address |
base | Database name (must exist) |
port | MySQL server port |
username | Database user |
password | Database password |
Best for: multi-server networks, large communities, production environments.
Tip: mineWallet uses HikariCP for connection pooling, ensuring efficient database performance.
MongoDB
A document-based database for distributed deployments.
database:
databaseType: MONGODB
mongoConnectionString: "mongodb://localhost:27017"
| Option | Description |
|---|---|
mongoConnectionString | Full MongoDB connection URI |
Best for: distributed systems, document-oriented storage, existing MongoDB infrastructure.
Redis Synchronization
Redis enables real-time data synchronization across multiple servers. When enabled, wallet changes, profile updates, and notifications are broadcast to all connected servers.
Configuration
redis:
enabled: true
hostname: "localhost:6379"
username: null
password: "securepass"
| Option | Type | Description |
|---|---|---|
enabled | Boolean | Master switch for Redis synchronization |
hostname | String | Redis server address with port |
username | String | Redis username (set to null if not required) |
password | String | Redis password |
What Gets Synced
| Topic | Description |
|---|---|
| Wallet Cache | Balance changes are propagated to all servers instantly |
| Profile Cache | Player profile data stays consistent across servers |
| Purchase Notifications | Purchase broadcasts can be sent to all servers |
| Recharge Notifications | Recharge broadcasts can be sent to all servers |
Notification Scope
Control whether notifications are sent to all servers or only the current one:
notification:
enabled: true
purchaseType: ALL_SERVERS
rechargeType: ALL_SERVERS
| Value | Description |
|---|---|
ALL_SERVERS | Broadcast to every connected server |
SINGLE | Show only on the server where the event occurred |
Caching
mineWallet uses Caffeine cache with a 1-hour time-to-live. When Redis is enabled, cache invalidation is propagated across all servers automatically. This means wallet lookups are fast (served from cache) while remaining consistent across the network.