All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.redisson.api.RObject Maven / Gradle / Ivy

There is a newer version: 3.36.0
Show newest version
/**
 * Copyright 2016 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.api;

import org.redisson.client.codec.Codec;

/**
 * Base interface for all Redisson objects
 *
 * @author Nikita Koksharov
 *
 */
public interface RObject extends RObjectAsync {

    /**
     * Update the last access time of an object. 
     * 
     * @return true if object was touched else false
     */
    boolean touch();
    
    /**
     * Transfer an object from source Redis instance to destination Redis instance
     *
     * @param host - destination host
     * @param port - destination port
     * @param database - destination database
     */
    void migrate(String host, int port, int database);

    /**
     * Move object to another database
     *
     * @param database - Redis database number
     * @return true if key was moved else false
     */
    boolean move(int database);

    /**
     * Returns name of object
     *
     * @return name - name of object
     */
    String getName();

    /**
     * Deletes the object
     * 
     * @return true if it was exist and deleted else false
     */
    boolean delete();

    /**
     * Delete the objects.
     * Actual removal will happen later asynchronously.
     * 

* Requires Redis 4.0+ * * @return true if it was exist and deleted else false */ boolean unlink(); /** * Rename current object key to newName * * @param newName - new name of object */ void rename(String newName); /** * Rename current object key to newName * only if new key is not exists * * @param newName - new name of object * @return true if object has been renamed successfully and false otherwise */ boolean renamenx(String newName); /** * Check object existence * * @return true if object exists and false otherwise */ boolean isExists(); /** * Returns the underlying Codec used by this RObject * * @return Codec of object */ Codec getCodec(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy