public class BalanceTable extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BALANCE_FIELD
Redis cluster balance field constant key.
|
static String |
CLIENT_BALANCE_TABLE
MySQL table name where balance information can be found
|
| Constructor and Description |
|---|
BalanceTable() |
| Modifier and Type | Method and Description |
|---|---|
static double |
getMysqlBalance(long accountId)
If the given accountId is not present in redis then it will be loaded from mysql database and be saved in redis
cluster.
|
static void |
loadMysqlBalance(Map<Long,Double> balanceMap)
Load the full list of client and their balance from mysql
CLIENT_BALANCE_TABLE table into the given map. |
static boolean |
setMysqlBalance(long accountId,
double balance,
double credit)
If the given accountId is not present in redis then it will be loaded from mysql database and be saved in redis
cluster.
|
public static final String CLIENT_BALANCE_TABLE
public static final String BALANCE_FIELD
public static double getMysqlBalance(long accountId)
accountId - Account ID for which balance information will be loaded into redis.public static boolean setMysqlBalance(long accountId,
double balance,
double credit)
accountId - Account ID for which balance information will be loaded into redis.balance - Amount to be set in BALANCE_FIELD in CLIENT_BALANCE_TABLE tablecredit - Amount to be set in CREDIT_FIELD in CLIENT_BALANCE_TABLE tablepublic static void loadMysqlBalance(Map<Long,Double> balanceMap)
CLIENT_BALANCE_TABLE table into the given map.balanceMap - ClientID vs usable balance map, which will be updated according to CLIENT_BALANCE_TABLECopyright © 2023. All rights reserved.