Package com.reve.balancemanager.recharge
Class RechargeManager
java.lang.Object
com.reve.balancemanager.recharge.RechargeManager
This class is responsible for balance update in redis cluster.
Asynchronously search for all keys containing the given accountID
-
Constructor Summary
ConstructorsConstructorDescriptionRechargeManager(com.reve.redis.cluster.ClusterObserver clusterObserver) Create an instance for Redis balance update with SSL.RechargeManager(String redisClusterHostIp, int redisClusterHostPort, String redisClusterPassword, com.reve.websocket.ssl.SSLConfiguration sslConfiguration) Create an instance for Redis balance update with SSL. -
Method Summary
Modifier and TypeMethodDescriptiondecreaseBalance(long accountID, double balance, double credit) Decrease the balance for the given accountIDincreaseBalance(long accountID, double balance, double credit) Increase the balance for the given accountID
-
Constructor Details
-
RechargeManager
public RechargeManager(String redisClusterHostIp, int redisClusterHostPort, String redisClusterPassword, com.reve.websocket.ssl.SSLConfiguration sslConfiguration) Create an instance for Redis balance update with SSL.- Parameters:
redisClusterHostIp- Redis cluster host ip addressredisClusterHostPort- Redis cluster host portredisClusterPassword- Redis cluster auth passwordsslConfiguration- SSL Configuration for redis cluster. If this value is null, communication with the server will be done using non-ssl tcp socket.
-
RechargeManager
public RechargeManager(com.reve.redis.cluster.ClusterObserver clusterObserver) Create an instance for Redis balance update with SSL.- Parameters:
clusterObserver- contains all the connections to the redis-cluster
-
-
Method Details
-
increaseBalance
Increase the balance for the given accountID- Parameters:
accountID- Account id for balance to be increasedbalance- Amount of balance to be increasedcredit- Amount of credit value to be increased- Returns:
- the remaining balance in redis, after the operation is done.
-
decreaseBalance
Decrease the balance for the given accountID- Parameters:
accountID- Account id for balance to be decreasedbalance- Amount of balance to be decreasedcredit- Amount of credit value to be decreased- Returns:
- the remaining balance in redis, after the operation is done.
-