当前位置: 首页>>代码示例>>Java>>正文


Java Jedis.del方法代码示例

本文整理汇总了Java中redis.clients.jedis.Jedis.del方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.del方法的具体用法?Java Jedis.del怎么用?Java Jedis.del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.Jedis的用法示例。


在下文中一共展示了Jedis.del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public void init(Object obj) {
    super.init(obj);
    PropertiesWrapper propertiesWrapper = (PropertiesWrapper) obj;
    if (propertiesWrapper.getBooleanProperty("redis", false)) {
        redis = true;
    }
    //清空之前的数据
    Jedis jedis = getJedis();
    jedis.del(RedisUtils.createKeyWithNameSpace(ACTOR_GLOBAL_PATH_INDEX, nameSpace));

    MapStructure<String> mapStructure = RedisStrutureBuilder.ofMap(jedis, String.class).withNameSpace(nameSpace).build();
    jedis.del(RedisUtils.createKeyWithNameSpace(AREA_MANAGER_INDEX, nameSpace));
    jedis.close();
    super.setActive();
}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:17,代码来源:CacheManager.java

示例2: clear

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public void clear(String queueID) {
    if (!lockQueue(queueID)) {
        return;
    }
    @Cleanup Jedis jedis = jedisPool.getResource();
    try {
        for (String sliceID : sliceQueue(queueID)) {
            jedis.del(makePoolQueueKey(queueID, sliceID));
        }
        jedis.del(makeDataKey(queueID));
        jedis.del(makeSliceQueueKey(queueID));
    } finally {
        unLockQueue(queueID);
    }
}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:17,代码来源:JedisSegmentQueueStore.java

示例3: setList

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 设置List缓存
 *
 * @param key          键
 * @param value        值
 * @param cacheSeconds 超时时间,0为不超时
 * @return
 */
public static long setList(String key, List<String> value, int cacheSeconds) {
	long result = 0;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(key)) {
			jedis.del(key);
		}
		result = jedis.rpush(key, (String[]) value.toArray());
		if (cacheSeconds != 0) {
			jedis.expire(key, cacheSeconds);
		}
		logger.debug("setList {} = {}", key, value);
	} catch (Exception e) {
		logger.warn("setList {} = {}", key, value, e);
	} finally {
		returnResource(jedis);
	}
	return result;
}
 
开发者ID:funtl,项目名称:framework,代码行数:29,代码来源:JedisUtils.java

示例4: deleteByKey

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public long deleteByKey(int dbIndex, byte[] key) throws Exception {
    Jedis jedis = null;
    try {
        jedis = getJedis();
        jedis.select(dbIndex);
        Long result = jedis.del(key);
        return result;
    } catch (Exception e) {
        throw e;
    } finally {
    	if(null != jedis)
    	{
    		jedis.close();
    	}
    }
}
 
开发者ID:wjggwm,项目名称:webside,代码行数:17,代码来源:RedisManager.java

示例5: delObject

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 删除缓存
 * @param key 键
 * @return
 */
public static long delObject(String key) {
	long result = 0;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(getBytesKey(key))){
			result = jedis.del(getBytesKey(key));
			logger.debug("delObject {}", key);
		}else{
			logger.debug("delObject {} not exists", key);
		}
	} catch (Exception e) {
		logger.warn("delObject {}", key, e);
	} finally {
		returnResource(jedis);
	}
	return result;
}
 
开发者ID:egojit8,项目名称:easyweb,代码行数:24,代码来源:JedisUtils.java

示例6: delObject

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public boolean delObject(String key) {
    log.trace("strar delete cache with " + key);
    Jedis jedis = null;
    try {
        jedis = redisConnection.getJedis();
        jedis.select(dbIndex);
        return jedis.del(key.getBytes()) > 0;
    } catch (Exception e) {
        log.warn(e.getMessage(), e);
    } finally {
        if (jedis != null) {
            jedis.close();
        }
    }

    return false;
}
 
开发者ID:gaochao2000,项目名称:redis_util,代码行数:18,代码来源:CacheServiceRedisImpl.java

示例7: delete

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public void delete(Session session) {
	if (session == null || session.getId() == null) {
		return;
	}
	
	Jedis jedis = null;
	try {
		jedis = JedisUtils.getResource();
		
		jedis.hdel(JedisUtils.getBytesKey(sessionKeyPrefix), JedisUtils.getBytesKey(session.getId().toString()));
		jedis.del(JedisUtils.getBytesKey(sessionKeyPrefix + session.getId()));

		logger.debug("delete {} ", session.getId());
	} catch (Exception e) {
		logger.error("delete {} ", session.getId(), e);
	} finally {
		JedisUtils.returnResource(jedis);
	}
}
 
开发者ID:egojit8,项目名称:easyweb,代码行数:21,代码来源:JedisSessionDAO.java

示例8: doDelete

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 删除会话
 * 当会话过期/会话停止时会调用
 * @param session
 */
@Override
protected void doDelete(Session session) {
    logger.debug("begin doDelete {}", session);
    Jedis jedis = null;
    try {
        jedis = jedisPool.getResource();
        jedis.del(prefix + session.getId());
        this.uncache(session.getId());
        logger.debug("shiro session id {} 被删除", session.getId());
    } catch (Exception e){
        logger.warn("删除session失败",e);
    } finally {
        jedis.close();
    }
}
 
开发者ID:ZhuXS,项目名称:Spring-Shiro-Spark,代码行数:21,代码来源:ShiroSessionDao.java

示例9: del

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void del(String key) {
    Jedis jedis = null;
    try {
        jedis = getJedis();
        if (jedis != null) {
            jedis.del(key);
        } else {
            logger.error("del opt connection null error!");
        }
    } catch (JedisConnectionException e) {
        if (jedis != null) {
            jedis.close();
            jedis = null;
        }
        logger.error("delete connect error:", e);
    } finally {
        returnJedisResource(jedis);
    }
}
 
开发者ID:Zephery,项目名称:newblog,代码行数:20,代码来源:JedisUtil.java

示例10: processExpires

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public void processExpires() {
	long timeStart = System.currentTimeMillis();
	int expired = 0;
	Jedis jedis = null;
	boolean error = true;
	try {
		// retrieve all session IDs from redis without changing their lastAccessedTime
		jedis = acquireConnection();
		Set<String> sessionIds = jedis.keys("*");
		if (log.isDebugEnabled()) {
			log.debug(String.format("Starting to expire sessions, checking %s", sessionIds.size()));
		}
		for (String sessionId : sessionIds) {
			try {
				byte[] data = jedis.get(sessionId.getBytes());
				RedisSession session = createEmptySession();
				serializer.deserializeInto(data, session, new SessionSerializationMetadata());
				if (null != session && !session.isValid()) {
					expired++;
				}
			} catch (IOException | ReflectiveOperationException e) {
				log.error(String.format("error reading session %s", sessionId));
				jedis.del(sessionId.getBytes());
			}
		}
		error = false;
	} finally {
		if (jedis != null) {
			returnConnection(jedis, error);
		}
	}

	long duration = System.currentTimeMillis() - timeStart;
	if (log.isDebugEnabled()) {
		log.debug(String.format("Expired %s sessions in %sms", expired, duration));
	}
	processingTime += duration;
}
 
开发者ID:appNG,项目名称:appng-tomcat-session,代码行数:40,代码来源:RedisSessionManager.java

示例11: del

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public boolean del(String key) {
	Jedis jedis = getJedisPool().getResource();
	try {
		jedis.del(key);
		return true;
	} catch (Exception e) {
		logger.error("del ", e);
		return false;
	} finally {
		getJedisPool().returnResource(jedis);
	}
}
 
开发者ID:zh-cn-trio,项目名称:trioAop,代码行数:14,代码来源:RedisStringOperationImpl.java

示例12: del

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Long del(String key) {
	Jedis jedis = jedisPool.getResource();
	Long result = jedis.del(key);
	jedis.close();
	return result;
}
 
开发者ID:mmdsyl,项目名称:BLOG-Microservice,代码行数:8,代码来源:JedisClientPool.java

示例13: testCreateRedisPoolAndConnection

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Test
public void testCreateRedisPoolAndConnection() throws Exception {
    RedisPools result = poolManagement.createRedisPoolAndConnection(property);
    Jedis jedis = result.getJedis();
    jedis.set("names","testCreateRedisPoolAndConnection");
    Assert.assertEquals("testCreateRedisPoolAndConnection",jedis.get("names"));
    jedis.del("names");
}
 
开发者ID:Kuangcp,项目名称:MythRedisClient,代码行数:9,代码来源:PoolManagementTest.java

示例14: deletePlayerPearl

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void deletePlayerPearl(UUID player, UUID pearl)
{
    Jedis jedis = SamaGamesAPI.get().getBungeeResource();

    if (jedis == null)
        return;

    if (jedis.exists("pearls:" + player.toString() + ":" + pearl.toString()))
        jedis.del("pearls:" + player.toString() + ":" + pearl.toString());

    jedis.close();
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:13,代码来源:GraouManager.java

示例15: finalizePearlCrafting

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void finalizePearlCrafting(Player player, UUID craftingPearlUUID)
{
    Jedis jedis = SamaGamesAPI.get().getBungeeResource();

    if (jedis == null)
        return;

    CraftingPearl craftingPearl = null;

    if (jedis.exists("crafting-pearls:" + player.getUniqueId().toString() + ":" + craftingPearlUUID.toString()))
        craftingPearl = new Gson().fromJson(jedis.get("crafting-pearls:" + player.getUniqueId().toString() + ":" + craftingPearlUUID.toString()), CraftingPearl.class);

    if (craftingPearl == null)
    {
        jedis.close();
        return;
    }

    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DAY_OF_MONTH, 7);

    Pearl craftedPearl = new Pearl(craftingPearl.getUUID(), craftingPearl.getStars(), calendar.getTime().getTime());
    this.addPearlToPlayer(player, craftedPearl);

    jedis.del("crafting-pearls:" + player.getUniqueId().toString() + ":" + craftingPearlUUID.toString());

    jedis.close();

    this.hub.getInteractionManager().getGraouManager().update(player);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:31,代码来源:WellManager.java


注:本文中的redis.clients.jedis.Jedis.del方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。