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

top.netkit.redis.client.command.HashCommandExecutor Maven / Gradle / Ivy

The newest version!
package top.netkit.redis.client.command;

import com.fasterxml.jackson.core.type.TypeReference;

import java.util.List;
import java.util.Map;

/**
 * hash command executor
 * @author shixinke
 */
public interface HashCommandExecutor extends CommandExecutor {

    /**
     * delete multi fields
     * @param key redis key
     * @param fields hash members
     * @return boolean
     */
    boolean hDel(String key, List fields);

    /**
     * delete hash member
     * @param key redis key
     * @param field hash member
     * @return boolean
     */
    boolean hDel(String key, String field);

    /**
     * check member is exists
     * @param key hash key
     * @param field hash member
     * @return boolean
     */
    boolean hExists(String key, String field);

    /**
     * get hash member value
     * @param key hash key
     * @param field hash member
     * @param clazz Class of hash member value
     * @param  member value type
     * @return V
     */
     V hGet(String key, String field, Class clazz);

    /**
     * get hash member value
     * @param key hash key
     * @param field hash member
     * @param typeReference value type
     * @param  member item value type
     * @return V
     */
     V hGet(String key, String field, TypeReference typeReference);

    /**
     * get all values of the key
     * @param key hash key
     * @param  hash member value type
     * @param clazz hash member value type
     * @return Map
     */
     Map hGetAll(String key, Class clazz);

    /**
     * increment by the step
     * @param key hash key
     * @param field hash member
     * @param step step
     * @return long
     */
    long hIncr(String key, String field, int step);

    /**
     * increment by step
     * @param key hash key
     * @param field hash member
     * @param step step
     * @return double
     */
    double hIncrByFloat(String key, String field, double step);

    /**
     * get all the keys of the key
     * @param key hash key
     * @return List
     */
    List hKeys(String key);

    /**
     * get length of the hash
     * @param key hash key
     * @return long
     */
    long hLen(String key);

    /**
     * multi get values of the members
     * @param key hash key
     * @param fields hash member
     * @param clazz hash member value type
     * @param  hash member value type
     * @return Map
     */
     Map hMGet(String key, List fields, Class clazz);

    /**
     * multi set value
     * @param key hash key
     * @param valuesMap values map
     * @return boolean
     */
     boolean hMSet(String key, Map valuesMap);

    /**
     * set value
     * @param key hash key
     * @param field hash member
     * @param value hash member value
     * @return boolean
     */
     boolean hSet(String key, String field, V value);

    /**
     * set member value if field is not exist
     * @param key hash key
     * @param field hash member
     * @param value hash value
     * @return boolean
     */
     boolean hSetNx(String key, String field, V value);

    /**
     * get length of a member value
     * @param key hash key
     * @param field hash member
     * @return long
     */
    long hStrLen(String key, String field);

    /**
     * get all values of a key
     * @param key hash key
     * @param clazz hash value type
     * @param  hash value type
     * @return V
     */
     List hVals(String key, Class clazz);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy