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

com.yuweix.kuafu.data.cache.redis.RedisCache Maven / Gradle / Ivy

The newest version!
package com.yuweix.kuafu.data.cache.redis;


import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.yuweix.kuafu.data.cache.Cache;
import com.yuweix.kuafu.data.cache.MessageHandler;


/**
 * @author yuwei
 */
public interface RedisCache extends Cache {
	/**
	 * 订阅消息
	 * @param channel
	 * @param handler
	 */
	void subscribe(String channel, MessageHandler handler);
	void subscribe(List channels, MessageHandler handler);

	/**
	 * 发布消息
	 * @param channel
	 * @param message
	 */
	void publish(String channel, String message);

	/**
	 * timeout 过期时间(s)。
	 * @return
	 */
	boolean hset(String key, String field, T value, long timeout);
	boolean hmset(String key, Map entries, long timeout);
	T hget(String key, String field);
	Map hgetAll(String key);
	void remove(String key, String field);

	/**
	 * timeout 过期时间(s)。
	 * @return
	 */
	boolean lpush(String key, T value, long timeout);
	boolean lpush(String key, List valList, long timeout);
	boolean rpush(String key, T value, long timeout);
	boolean rpush(String key, List valList, long timeout);
	long lsize(String key);
	T lindex(String key, long index);
	List lrange(String key, long start, long end);
	void ltrim(String key, long start, long end);
	void lset(String key, long index, T value);
	T lpop(String key);
	T rpop(String key);

	/**
	 * timeout 过期时间(s)。
	 */
	void sadd(String key, T value, long timeout);
	void sadd(String key, List valList, long timeout);
	long slen(String key);
	Set sdiff(String key, Collection otherKeys);
	void sdiffStore(String key, Collection otherKeys, String destKey);
	Set sinter(String key, Collection otherKeys);
	void sinterStore(String key, Collection otherKeys, String destKey);
	Set sunion(String key, Collection otherKeys);
	void sunionStore(String key, Collection otherKeys, String destKey);
	boolean sisMember(String key, T member);
	Set smembers(String key);
	boolean smove(String sourceKey, String destKey, T member);
	boolean sremove(String key, Collection members);

	/**
	 * timeout 过期时间(s)。
	 */
	void zadd(String key, T value, double score, long timeout);
	void zadd(String key, Map memScore, long timeout);
	long zlen(String key);
	long zcount(String key, double min, double max);
	void zincrby(String key, T member, double increment);
	void zinterStore(String key, Collection otherKeys, String destKey);
	void zunionStore(String key, Collection otherKeys, String destKey);
	boolean zremove(String key, Collection members);
	Double zscore(String key, T member);
	Long zrank(String key, T member);

	String execute(String script, List keyList, List argList);
	S execute(String script, List keyList, List argList, Class returnType);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy