Package org.redisson

Class RedissonAtomicLong

    • Method Detail

      • addAndGet

        public long addAndGet​(long delta)
        Description copied from interface: RAtomicLong
        Atomically adds the given value to the current value.
        Specified by:
        addAndGet in interface RAtomicLong
        Parameters:
        delta - the value to add
        Returns:
        the updated value
      • addAndGetAsync

        public RFuture<Long> addAndGetAsync​(long delta)
        Description copied from interface: RAtomicLongAsync
        Atomically adds the given value to the current value.
        Specified by:
        addAndGetAsync in interface RAtomicLongAsync
        Parameters:
        delta - the value to add
        Returns:
        the updated value
      • compareAndSet

        public boolean compareAndSet​(long expect,
                                     long update)
        Description copied from interface: RAtomicLong
        Atomically sets the value to the given updated value only if the current value == the expected value.
        Specified by:
        compareAndSet in interface RAtomicLong
        Parameters:
        expect - the expected value
        update - the new value
        Returns:
        true if successful; or false if the actual value was not equal to the expected value.
      • compareAndSetAsync

        public RFuture<Boolean> compareAndSetAsync​(long expect,
                                                   long update)
        Description copied from interface: RAtomicLongAsync
        Atomically sets the value to the given updated value only if the current value == the expected value.
        Specified by:
        compareAndSetAsync in interface RAtomicLongAsync
        Parameters:
        expect - the expected value
        update - the new value
        Returns:
        true if successful; or false if the actual value was not equal to the expected value.
      • getAndDelete

        public long getAndDelete()
        Description copied from interface: RAtomicLong
        Gets and deletes object
        Specified by:
        getAndDelete in interface RAtomicLong
        Returns:
        the current value
      • decrementAndGet

        public long decrementAndGet()
        Description copied from interface: RAtomicLong
        Atomically decrements the current value by one.
        Specified by:
        decrementAndGet in interface RAtomicLong
        Returns:
        the updated value
      • get

        public long get()
        Description copied from interface: RAtomicLong
        Returns current value.
        Specified by:
        get in interface RAtomicLong
        Returns:
        the current value
      • getAndAdd

        public long getAndAdd​(long delta)
        Description copied from interface: RAtomicLong
        Atomically adds the given value to the current value.
        Specified by:
        getAndAdd in interface RAtomicLong
        Parameters:
        delta - the value to add
        Returns:
        the old value before the add
      • getAndAddAsync

        public RFuture<Long> getAndAddAsync​(long delta)
        Description copied from interface: RAtomicLongAsync
        Atomically adds the given value to the current value.
        Specified by:
        getAndAddAsync in interface RAtomicLongAsync
        Parameters:
        delta - the value to add
        Returns:
        the old value before the add
      • getAndSet

        public long getAndSet​(long newValue)
        Description copied from interface: RAtomicLong
        Atomically sets the given value and returns the old value.
        Specified by:
        getAndSet in interface RAtomicLong
        Parameters:
        newValue - the new value
        Returns:
        the old value
      • getAndSetAsync

        public RFuture<Long> getAndSetAsync​(long newValue)
        Description copied from interface: RAtomicLongAsync
        Atomically sets the given value and returns the old value.
        Specified by:
        getAndSetAsync in interface RAtomicLongAsync
        Parameters:
        newValue - the new value
        Returns:
        the old value
      • incrementAndGet

        public long incrementAndGet()
        Description copied from interface: RAtomicLong
        Atomically increments the current value by one.
        Specified by:
        incrementAndGet in interface RAtomicLong
        Returns:
        the updated value
      • getAndIncrement

        public long getAndIncrement()
        Description copied from interface: RAtomicLong
        Atomically increments the current value by one.
        Specified by:
        getAndIncrement in interface RAtomicLong
        Returns:
        the old value
      • getAndDecrement

        public long getAndDecrement()
        Description copied from interface: RAtomicLong
        Atomically decrements by one the current value.
        Specified by:
        getAndDecrement in interface RAtomicLong
        Returns:
        the previous value
      • set

        public void set​(long newValue)
        Description copied from interface: RAtomicLong
        Atomically sets the given value.
        Specified by:
        set in interface RAtomicLong
        Parameters:
        newValue - the new value
      • expire

        public boolean expire​(long timeToLive,
                              TimeUnit timeUnit)
        Description copied from interface: RExpirable
        Set a timeout for object. After the timeout has expired, the key will automatically be deleted.
        Specified by:
        expire in interface RExpirable
        Parameters:
        timeToLive - - timeout before object will be deleted
        timeUnit - - timeout time unit
        Returns:
        true if the timeout was set and false if not
      • expireAsync

        public RFuture<Boolean> expireAsync​(long timeToLive,
                                            TimeUnit timeUnit)
        Description copied from interface: RExpirableAsync
        Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.
        Specified by:
        expireAsync in interface RExpirableAsync
        Parameters:
        timeToLive - - timeout before object will be deleted
        timeUnit - - timeout time unit
        Returns:
        true if the timeout was set and false if not
      • expireAt

        public boolean expireAt​(long timestamp)
        Description copied from interface: RExpirable
        Set an expire date for object. When expire date comes the key will automatically be deleted.
        Specified by:
        expireAt in interface RExpirable
        Parameters:
        timestamp - - expire date in milliseconds (Unix timestamp)
        Returns:
        true if the timeout was set and false if not
      • expireAtAsync

        public RFuture<Boolean> expireAtAsync​(long timestamp)
        Description copied from interface: RExpirableAsync
        Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.
        Specified by:
        expireAtAsync in interface RExpirableAsync
        Parameters:
        timestamp - - expire date in milliseconds (Unix timestamp)
        Returns:
        true if the timeout was set and false if not
      • expireAt

        public boolean expireAt​(Date timestamp)
        Description copied from interface: RExpirable
        Set an expire date for object. When expire date comes the key will automatically be deleted.
        Specified by:
        expireAt in interface RExpirable
        Parameters:
        timestamp - - expire date
        Returns:
        true if the timeout was set and false if not
      • expireAtAsync

        public RFuture<Boolean> expireAtAsync​(Date timestamp)
        Description copied from interface: RExpirableAsync
        Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.
        Specified by:
        expireAtAsync in interface RExpirableAsync
        Parameters:
        timestamp - - expire date
        Returns:
        true if the timeout was set and false if not
      • clearExpire

        public boolean clearExpire()
        Description copied from interface: RExpirable
        Clear an expire timeout or expire date for object.
        Specified by:
        clearExpire in interface RExpirable
        Returns:
        true if timeout was removed false if object does not exist or does not have an associated timeout
      • clearExpireAsync

        public RFuture<Boolean> clearExpireAsync()
        Description copied from interface: RExpirableAsync
        Clear an expire timeout or expire date for object in async mode. Object will not be deleted.
        Specified by:
        clearExpireAsync in interface RExpirableAsync
        Returns:
        true if the timeout was cleared and false if not
      • remainTimeToLive

        public long remainTimeToLive()
        Description copied from interface: RExpirable
        Remaining time to live of Redisson object that has a timeout
        Specified by:
        remainTimeToLive in interface RExpirable
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
      • remainTimeToLiveAsync

        public RFuture<Long> remainTimeToLiveAsync()
        Description copied from interface: RExpirableAsync
        Remaining time to live of Redisson object that has a timeout
        Specified by:
        remainTimeToLiveAsync in interface RExpirableAsync
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.