Interface RObject

    • Method Detail

      • getIdleTime

        Long getIdleTime()
        Returns number of seconds spent since last write or read operation over this object.
        Returns:
        number of seconds
      • sizeInMemory

        long sizeInMemory()
        Returns bytes amount used by object in Redis memory.
        Returns:
        size in bytes
      • restore

        void restore(byte[] state)
        Restores object using its state returned by dump() method.
        Parameters:
        state - - state of object
      • restore

        void restore(byte[] state,
                     long timeToLive,
                     TimeUnit timeUnit)
        Restores object using its state returned by dump() method and set time to live for it.
        Parameters:
        state - - state of object
        timeToLive - - time to live of the object
        timeUnit - - time unit
      • restoreAndReplace

        void restoreAndReplace(byte[] state)
        Restores and replaces object if it already exists.
        Parameters:
        state - - state of the object
      • restoreAndReplace

        void restoreAndReplace(byte[] state,
                               long timeToLive,
                               TimeUnit timeUnit)
        Restores and replaces object if it already exists and set time to live for it.
        Parameters:
        state - - state of the object
        timeToLive - - time to live of the object
        timeUnit - - time unit
      • dump

        byte[] dump()
        Returns dump of object
        Returns:
        dump
      • touch

        boolean touch()
        Update the last access time of an object.
        Returns:
        true if object was touched else false
      • migrate

        void migrate(String host,
                     int port,
                     int database,
                     long timeout)
        Copy object from source Redis instance to destination Redis instance
        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
      • copy

        void copy(String host,
                  int port,
                  int database,
                  long timeout)
        Copy object from source Redis instance to destination Redis instance
        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
      • move

        boolean move(int database)
        Move object to another database
        Parameters:
        database - - Redis database number
        Returns:
        true if key was moved else false
      • getName

        String getName()
        Returns name of object
        Returns:
        name - name of object
      • delete

        boolean delete()
        Deletes the object
        Returns:
        true if it was exist and deleted else false
      • unlink

        boolean unlink()
        Delete the objects. Actual removal will happen later asynchronously.

        Requires Redis 4.0+

        Returns:
        true if it was exist and deleted else false
      • rename

        void rename(String newName)
        Rename current object key to newName
        Parameters:
        newName - - new name of object
      • renamenx

        boolean renamenx(String newName)
        Rename current object key to newName only if new key is not exists
        Parameters:
        newName - - new name of object
        Returns:
        true if object has been renamed successfully and false otherwise
      • isExists

        boolean isExists()
        Check object existence
        Returns:
        true if object exists and false otherwise
      • getCodec

        Codec getCodec()
        Returns the underlying Codec used by this RObject
        Returns:
        Codec of object
      • removeListener

        void removeListener(int listenerId)
        Removes object event listener
        Parameters:
        listenerId - - listener id