Package org.redisson

Class RedissonObject

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <T extends ObjectListener>
      int
       name, T listener, <T,​> consumer)  
      int addListener​(ObjectListener listener)
      Adds object event listener
      protected <T extends >  name, T listener, <T,​> consumer)  
      > addListenerAsync​(ObjectListener listener)
      Adds object event listener
      void  host, int port, int database, long timeout)
      Copy object from source Redis instance to destination Redis instance
      >  host, int port, int database, long timeout)
      Copy object from source Redis instance to destination Redis instance in async mode
      boolean delete()
      Deletes the object
      > deleteAsync()
      Delete object in async mode
      protected > ... keys)  
      byte[] dump()
      Returns dump of object
      RFuture<byte[]> dumpAsync()
      Returns dump of object
      io.netty.buffer.ByteBuf  value)  
      protected <io.netty.buffer.ByteBuf> ... values)  
      protected <io.netty.buffer.ByteBuf> <?> values)  
      void <> params, <?> values)  
      io.netty.buffer.ByteBuf  value)  
      protected void <> params, <?> values)  
      io.netty.buffer.ByteBuf  value)  
      protected void <> params, <?> values)  
      protected <V> V get​(RFuture<V> future)  
      Codec getCodec()
      Returns the underlying Codec used by this RObject
      getIdleTime()
      Returns number of seconds spent since last write or read operation over this object.
      > getIdleTimeAsync()
      Returns number of seconds spent since last write or read operation over this object.
       key,  suffix)  
       key,  suffix)  
      getName()
      Returns name of object
      getRawName()  
      protected  o)  
      boolean isExists()
      Check object existence
      > isExistsAsync()
      Check object existence in async mode.
      void  host, int port, int database, long timeout)
      Copy object from source Redis instance to destination Redis instance
      >  host, int port, int database, long timeout)
      Transfer object from source Redis instance to destination Redis instance in async mode
      boolean move​(int database)
      Move object to another database
      > moveAsync​(int database)
      Move object to another database in async mode
      static  prefix,  name)  
      void removeListener​(int listenerId)
      Removes object event listener
      > removeListenerAsync​(int listenerId)
      Removes object event listener
      protected void removeListenersAsync​(int listenerId, > listener)  
      void  newName)
      Rename current object key to newName
      >  newName)
      Rename current object key to newName in async mode
      boolean  newName)
      Rename current object key to newName only if new key is not exists
      >  newName)
      Rename current object key to newName in async mode only if new key is not exists
      void restore​(byte[] state)
      Restores object using its state returned by RObject.dump() method.
      void restore​(byte[] state, long timeToLive,  timeUnit)
      Restores object using its state returned by RObject.dump() method and set time to live for it.
      void restoreAndReplace​(byte[] state)
      Restores and replaces object if it already exists.
      void restoreAndReplace​(byte[] state, long timeToLive,  timeUnit)
      Restores and replaces object if it already exists and set time to live for it.
      > restoreAndReplaceAsync​(byte[] state)
      Restores and replaces object if it already exists.
      > restoreAndReplaceAsync​(byte[] state, long timeToLive,  timeUnit)
      Restores and replaces object if it already exists and set time to live for it.
      > restoreAsync​(byte[] state)
      Restores object using its state returned by RObjectAsync.dumpAsync() method.
      > restoreAsync​(byte[] state, long timeToLive,  timeUnit)
      Restores object using its state returned by RObjectAsync.dumpAsync() method and set time to live for it.
      protected void  name)  
      long sizeInMemory()
      Returns bytes amount used by object in Redis memory.
      > sizeInMemoryAsync()
      Returns bytes amount used by object in Redis memory.
      > <> keys)  
      > sizeInMemoryAsync​(CommandAsyncExecutor commandExecutor, <> keys)  
      static  name,  suffix)  
      protected long toSeconds​(long timeout,  unit)  
      protected <T> <T> <T> iterator)  
      boolean touch()
      Update the last access time of an object.
      > touchAsync()
      Update the last access time of an object in async mode.
      boolean unlink()
      Delete the objects.
      > unlinkAsync()
      Delete the objects.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • prefixName

        public static  prefixName​( prefix,
                                         name)
      • suffixName

        public static  suffixName​( name,
                                         suffix)
      • toStream

        protected final <T> <T> toStream​(<T> iterator)
      • get

        protected final <V> V get​(RFuture<V> future)
      • toSeconds

        protected final long toSeconds​(long timeout,
                                        unit)
      • getName

        public  getName()
        Description copied from interface: RObject
        Returns name of object
        Specified by:
        getName in interface RObject
        Returns:
        name - name of object
      • getRawName

        public final  getRawName()
      • getRawName

        protected  getRawName​( o)
      • setName

        protected final void setName​( name)
      • rename

        public void rename​( newName)
        Description copied from interface: RObject
        Rename current object key to newName
        Specified by:
        rename in interface RObject
        Parameters:
        newName - - new name of object
      • sizeInMemoryAsync

        public > sizeInMemoryAsync()
        Description copied from interface: RObjectAsync
        Returns bytes amount used by object in Redis memory.
        Specified by:
        sizeInMemoryAsync in interface RObjectAsync
        Returns:
        size in bytes
      • sizeInMemoryAsync

        public final > sizeInMemoryAsync​(<> keys)
      • sizeInMemoryAsync

        public final > sizeInMemoryAsync​(CommandAsyncExecutor commandExecutor,
                                                     <> keys)
      • sizeInMemory

        public long sizeInMemory()
        Description copied from interface: RObject
        Returns bytes amount used by object in Redis memory.
        Specified by:
        sizeInMemory in interface RObject
        Returns:
        size in bytes
      • renameAsync

        public > renameAsync​( newName)
        Description copied from interface: RObjectAsync
        Rename current object key to newName in async mode
        Specified by:
        renameAsync in interface RObjectAsync
        Parameters:
        newName - - new name of object
        Returns:
        void
      • migrate

        public void migrate​( host,
                            int port,
                            int database,
                            long timeout)
        Description copied from interface: RObject
        Copy object from source Redis instance to destination Redis instance
        Specified by:
        migrate in interface RObject
        Parameters:
        host - - destination host
        port - - destination port
        database - - destination database
        timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
      • migrateAsync

        public > migrateAsync​( host,
                                          int port,
                                          int database,
                                          long timeout)
        Description copied from interface: RObjectAsync
        Transfer object from source Redis instance to destination Redis instance in async mode
        Specified by:
        migrateAsync in interface RObjectAsync
        Parameters:
        host - - destination host
        port - - destination port
        database - - destination database
        timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
        Returns:
        void
      • copy

        public void copy​( host,
                         int port,
                         int database,
                         long timeout)
        Description copied from interface: RObject
        Copy object from source Redis instance to destination Redis instance
        Specified by:
        copy in interface RObject
        Parameters:
        host - - destination host
        port - - destination port
        database - - destination database
        timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
      • copyAsync

        public > copyAsync​( host,
                                       int port,
                                       int database,
                                       long timeout)
        Description copied from interface: RObjectAsync
        Copy object from source Redis instance to destination Redis instance in async mode
        Specified by:
        copyAsync in interface RObjectAsync
        Parameters:
        host - - destination host
        port - - destination port
        database - - destination database
        timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
        Returns:
        void
      • move

        public boolean move​(int database)
        Description copied from interface: RObject
        Move object to another database
        Specified by:
        move in interface RObject
        Parameters:
        database - - Redis database number
        Returns:
        true if key was moved else false
      • moveAsync

        public > moveAsync​(int database)
        Description copied from interface: RObjectAsync
        Move object to another database in async mode
        Specified by:
        moveAsync in interface RObjectAsync
        Parameters:
        database - - number of Redis database
        Returns:
        true if key was moved false if not
      • renamenx

        public boolean renamenx​( newName)
        Description copied from interface: RObject
        Rename current object key to newName only if new key is not exists
        Specified by:
        renamenx in interface RObject
        Parameters:
        newName - - new name of object
        Returns:
        true if object has been renamed successfully and false otherwise
      • renamenxAsync

        public > renamenxAsync​( newName)
        Description copied from interface: RObjectAsync
        Rename current object key to newName in async mode only if new key is not exists
        Specified by:
        renamenxAsync in interface RObjectAsync
        Parameters:
        newName - - new name of object
        Returns:
        true if object has been renamed successfully and false otherwise
      • delete

        public boolean delete()
        Description copied from interface: RObject
        Deletes the object
        Specified by:
        delete in interface RObject
        Returns:
        true if it was exist and deleted else false
      • deleteAsync

        public > deleteAsync()
        Description copied from interface: RObjectAsync
        Delete object in async mode
        Specified by:
        deleteAsync in interface RObjectAsync
        Returns:
        true if object was deleted false if not
      • deleteAsync

        protected > deleteAsync​(... keys)
      • unlink

        public boolean unlink()
        Description copied from interface: RObject
        Delete the objects. Actual removal will happen later asynchronously.

        Requires Redis 4.0+

        Specified by:
        unlink in interface RObject
        Returns:
        true if it was exist and deleted else false
      • unlinkAsync

        public > unlinkAsync()
        Description copied from interface: RObjectAsync
        Delete the objects. Actual removal will happen later asynchronously.

        Requires Redis 4.0+

        Specified by:
        unlinkAsync in interface RObjectAsync
        Returns:
        true if it was exist and deleted else false
      • touch

        public boolean touch()
        Description copied from interface: RObject
        Update the last access time of an object.
        Specified by:
        touch in interface RObject
        Returns:
        true if object was touched else false
      • touchAsync

        public > touchAsync()
        Description copied from interface: RObjectAsync
        Update the last access time of an object in async mode.
        Specified by:
        touchAsync in interface RObjectAsync
        Returns:
        true if object was touched else false
      • isExists

        public boolean isExists()
        Description copied from interface: RObject
        Check object existence
        Specified by:
        isExists in interface RObject
        Returns:
        true if object exists and false otherwise
      • isExistsAsync

        public > isExistsAsync()
        Description copied from interface: RObjectAsync
        Check object existence in async mode.
        Specified by:
        isExistsAsync in interface RObjectAsync
        Returns:
        true if object exists and false otherwise
      • getCodec

        public Codec getCodec()
        Description copied from interface: RObject
        Returns the underlying Codec used by this RObject
        Specified by:
        getCodec in interface RObject
        Returns:
        Codec of object
      • encode

        protected <io.netty.buffer.ByteBuf> encode​(... values)
      • encode

        protected <io.netty.buffer.ByteBuf> encode​(<?> values)
      • encode

        public void encode​(<> params,
                           <?> values)
      • getLockByMapKey

        public  getLockByMapKey​( key,
                                       suffix)
      • getLockByValue

        public  getLockByValue​( key,
                                      suffix)
      • encodeMapKeys

        protected void encodeMapKeys​(<> params,
                                     <?> values)
      • encodeMapValues

        protected void encodeMapValues​(<> params,
                                       <?> values)
      • encode

        public io.netty.buffer.ByteBuf encode​( value)
      • encodeMapKey

        public io.netty.buffer.ByteBuf encodeMapKey​( value)
      • encodeMapValue

        public io.netty.buffer.ByteBuf encodeMapValue​( value)
      • dump

        public byte[] dump()
        Description copied from interface: RObject
        Returns dump of object
        Specified by:
        dump in interface RObject
        Returns:
        dump
      • restore

        public void restore​(byte[] state)
        Description copied from interface: RObject
        Restores object using its state returned by RObject.dump() method.
        Specified by:
        restore in interface RObject
        Parameters:
        state - - state of object
      • restore

        public void restore​(byte[] state,
                            long timeToLive,
                             timeUnit)
        Description copied from interface: RObject
        Restores object using its state returned by RObject.dump() method and set time to live for it.
        Specified by:
        restore in interface RObject
        Parameters:
        state - - state of object
        timeToLive - - time to live of the object
        timeUnit - - time unit
      • restoreAsync

        public > restoreAsync​(byte[] state,
                                          long timeToLive,
                                           timeUnit)
        Description copied from interface: RObjectAsync
        Restores object using its state returned by RObjectAsync.dumpAsync() method and set time to live for it.
        Specified by:
        restoreAsync in interface RObjectAsync
        Parameters:
        state - - state of object
        timeToLive - - time to live of the object
        timeUnit - - time unit
        Returns:
        void
      • restoreAndReplace

        public void restoreAndReplace​(byte[] state,
                                      long timeToLive,
                                       timeUnit)
        Description copied from interface: RObject
        Restores and replaces object if it already exists and set time to live for it.
        Specified by:
        restoreAndReplace in interface RObject
        Parameters:
        state - - state of the object
        timeToLive - - time to live of the object
        timeUnit - - time unit
      • restoreAndReplaceAsync

        public > restoreAndReplaceAsync​(byte[] state,
                                                    long timeToLive,
                                                     timeUnit)
        Description copied from interface: RObjectAsync
        Restores and replaces object if it already exists and set time to live for it.
        Specified by:
        restoreAndReplaceAsync in interface RObjectAsync
        Parameters:
        state - - state of the object
        timeToLive - - time to live of the object
        timeUnit - - time unit
        Returns:
        void
      • restoreAndReplace

        public void restoreAndReplace​(byte[] state)
        Description copied from interface: RObject
        Restores and replaces object if it already exists.
        Specified by:
        restoreAndReplace in interface RObject
        Parameters:
        state - - state of the object
      • restoreAndReplaceAsync

        public > restoreAndReplaceAsync​(byte[] state)
        Description copied from interface: RObjectAsync
        Restores and replaces object if it already exists.
        Specified by:
        restoreAndReplaceAsync in interface RObjectAsync
        Parameters:
        state - - state of the object
        Returns:
        void
      • getIdleTime

        public  getIdleTime()
        Description copied from interface: RObject
        Returns number of seconds spent since last write or read operation over this object.
        Specified by:
        getIdleTime in interface RObject
        Returns:
        number of seconds
      • getIdleTimeAsync

        public > getIdleTimeAsync()
        Description copied from interface: RObjectAsync
        Returns number of seconds spent since last write or read operation over this object.
        Specified by:
        getIdleTimeAsync in interface RObjectAsync
        Returns:
        number of seconds
      • addListener

        protected final <T extends  name,
                                                                   T listener,
                                                                   <T,​> consumer)
      • addListenerAsync

        protected final <T extends > addListenerAsync​( name,
                                                                                     T listener,
                                                                                     <T,​> consumer)
      • removeListener

        public void removeListener​(int listenerId)
        Description copied from interface: RObject
        Removes object event listener
        Specified by:
        removeListener in interface RObject
        Parameters:
        listenerId - - listener id
      • removeListenerAsync

        public > removeListenerAsync​(int listenerId)
        Description copied from interface: RObjectAsync
        Removes object event listener
        Specified by:
        removeListenerAsync in interface RObjectAsync
        Parameters:
        listenerId - - listener id
      • removeListenersAsync

        protected final void removeListenersAsync​(int listenerId,
                                                  > listener)