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"
OptionDescription
hostnameMySQL server address
baseDatabase name (must exist)
portMySQL server port
usernameDatabase user
passwordDatabase 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"
OptionDescription
mongoConnectionStringFull 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"
OptionTypeDescription
enabledBooleanMaster switch for Redis synchronization
hostnameStringRedis server address with port
usernameStringRedis username (set to null if not required)
passwordStringRedis password

What Gets Synced

TopicDescription
Wallet CacheBalance changes are propagated to all servers instantly
Profile CachePlayer profile data stays consistent across servers
Purchase NotificationsPurchase broadcasts can be sent to all servers
Recharge NotificationsRecharge 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
ValueDescription
ALL_SERVERSBroadcast to every connected server
SINGLEShow 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.