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

com.rustknife.jknife.cache.CacheRedisKit Maven / Gradle / Ivy

The newest version!
package com.rustknife.jknife.cache;

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

@SuppressWarnings({"WeakerAccess", "unchecked", "UnusedReturnValue"})
public class CacheRedisKit {

    private static CacheRedisContext ctx = new CacheRedisContext("redisTemplateRawKey");

    public static void flushAll(){
        ctx.flushAll();
    }

    public static boolean expire(String cacheName, String key, long time){
        return ctx.expire(cacheName, key, time);
    }

    public static long ttl(String cacheName, String key){
        return ctx.ttl(cacheName, key);
    }

    public static boolean hasKey(String cacheName, String key){
        return  ctx.hasKey(cacheName, key);
    }

    public static Set keys(String cacheName, String pattern){
        return ctx.keys(cacheName, pattern);
    }
    public static Set keysRaw(String cacheName, String pattern){
        return ctx.keysRaw(cacheName, pattern);
    }

    public static void del(String cacheName, String ... keys){
        ctx.del(cacheName, keys);
    }

    public static void del(String cacheName, Set keys){
        ctx.del(cacheName, keys);
    }

    public static void delByRowKeys(String ... keys){
        ctx.delByRowKeys(keys);
    }

    public static void delByRowKeys(Set keys){
        ctx.delByRowKeys(keys);
    }

    public static  T get(String cacheName, String key){
        return ctx.get(cacheName, key);
    }

    public static boolean set(String cacheName, String key,Object value) {
        return ctx.set(cacheName, key, value);
    }

    public static boolean set(String cacheName, String key,Object value,long time){
        return ctx.set(cacheName, key, value, time);
    }

    public static long incr(String cacheName, String key, long delta){
        return ctx.incr(cacheName, key, delta);
    }

    public static long decr(String cacheName, String key, long delta){
        return ctx.decr(cacheName, key, delta);
    }

    public static double incr(String cacheName, String key, double delta){
        return ctx.incr(cacheName, key, delta);
    }

    public static double decr(String cacheName, String key, double delta){
        return ctx.decr(cacheName, key, delta);
    }

    public static Object hget(String cacheName, String key,String item){
        return ctx.hget(cacheName, key, item);
    }

    public static Map hmget(String cacheName, String key){
        return ctx.hmget(cacheName, key);
    }

    public static boolean hmset(String cacheName, String key, Map map){
        return ctx.hmset(cacheName, key, map);
    }

    public static boolean hmset(String cacheName, String key, Map map, long time){
        return ctx.hmset(cacheName, key, map, time);
    }

    public static boolean hset(String cacheName, String key,String item,Object value) {
        return ctx.hset(cacheName, key, item, value);
    }

    public static boolean hset(String cacheName, String key,String item,Object value,long time) {
        return ctx.hset(cacheName, key, item, value, time);
    }

    public static void hdel(String cacheName, String key, Object... item){
        ctx.hdel(cacheName, key, item);
    }

    public static boolean hHasKey(String cacheName, String key, String item){
        return ctx.hHasKey(cacheName, key, item);
    }

    public static double hincr(String cacheName, String key, String item,double by){
        return ctx.hincr(cacheName, key, item, by);
    }

    public static double hdecr(String cacheName, String key, String item,double by){
        return ctx.hdecr(cacheName, key, item, by);
    }

    public static Set sGet(String cacheName, String key){
        return ctx.sGet(cacheName, key);
    }

    public static boolean sHasKey(String cacheName, String key,Object value){
        return ctx.sHasKey(cacheName, key, value);
    }

    public static long sSet(String cacheName, String key, Object...values) {
        return ctx.sSet(cacheName, key, values);
    }

    public static long sSetAndTime(String cacheName, String key,long time,Object...values) {
        return ctx.sSetAndTime(cacheName, key, time, values);
    }

    public static long sGetSetSize(String cacheName, String key){
        return ctx.sGetSetSize(cacheName, key);
    }

    public static long setRemove(String cacheName, String key, Object ...values) {
        return ctx.setRemove(cacheName, key, values);
    }

    public static List lGet(String cacheName, String key,long start, long end){
        return ctx.lGet(cacheName, key, start, end);
    }

    public static long lGetListSize(String cacheName, String key){
        return ctx.lGetListSize(cacheName, key);
    }

    public static Object lGetIndex(String cacheName, String key,long index){
        return ctx.lGetIndex(cacheName, key, index);
    }

    public static boolean lSet(String cacheName, String key, Object value) {
        return ctx.lSet(cacheName, key, value);
    }

    public static boolean lSet(String cacheName, String key, Object value, long time) {
        return ctx.lSet(cacheName, key, value, time);
    }

    public static boolean lSet(String cacheName, String key, List value) {
        return ctx.lSet(cacheName, key, value);
    }

    public static boolean lSet(String cacheName, String key, List value, long time) {
        return ctx.lSet(cacheName, key, value, time);
    }

    public static boolean lUpdateIndex(String cacheName, String key, long index,Object value) {
        return ctx.lUpdateIndex(cacheName, key, index, value);
    }

    public static long lRemove(String cacheName, String key,long count,Object value) {
        return ctx.lRemove(cacheName, key, count, value);
    }

}