Class RechargeManager

java.lang.Object
com.reve.balancemanager.recharge.RechargeManager

public class RechargeManager extends Object
This class is responsible for balance update in redis cluster. Asynchronously search for all keys containing the given accountID
  • Constructor Summary

    Constructors
    Constructor
    Description
    RechargeManager(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 Type
    Method
    Description
    decreaseBalance(long accountID, double balance, double credit)
    Decrease the balance for the given accountID
    increaseBalance(long accountID, double balance, double credit)
    Increase the balance for the given accountID

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 address
      redisClusterHostPort - Redis cluster host port
      redisClusterPassword - Redis cluster auth password
      sslConfiguration - 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

      public Double increaseBalance(long accountID, double balance, double credit)
      Increase the balance for the given accountID
      Parameters:
      accountID - Account id for balance to be increased
      balance - Amount of balance to be increased
      credit - Amount of credit value to be increased
      Returns:
      the remaining balance in redis, after the operation is done.
    • decreaseBalance

      public Double decreaseBalance(long accountID, double balance, double credit)
      Decrease the balance for the given accountID
      Parameters:
      accountID - Account id for balance to be decreased
      balance - Amount of balance to be decreased
      credit - Amount of credit value to be decreased
      Returns:
      the remaining balance in redis, after the operation is done.