Java Code Examples for redis.clients.jedis.Pipeline#hdel()

The following examples show how to use redis.clients.jedis.Pipeline#hdel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JedisPoolStream.java    From RedisDirectory with Apache License 2.0 6 votes vote down vote up
/**
 * Use transactions to delete index file
 *
 * @param fileLengthKey
 * @param fileDataKey
 * @param field
 * @param blockSize
 */
@Override
public void deleteFile(String fileLengthKey, String fileDataKey, String field, long blockSize) {
    Jedis jedis = null;
    try {
        jedis = jedisPool.getResource();
        Pipeline pipelined = jedis.pipelined();
        //delete file length
        pipelined.hdel(fileLengthKey.getBytes(), field.getBytes());
        //delete file content
        for (int i = 0; i < blockSize; i++) {
            byte[] blockName = getBlockName(field, i);
            pipelined.hdel(fileDataKey.getBytes(), blockName);
        }
        pipelined.sync();
    } finally {
        jedis.close();
    }
}
 
Example 2
Source File: JedisPoolStream.java    From RedisDirectory with Apache License 2.0 6 votes vote down vote up
/**
 * Use transactions to delete index file
 *
 * @param fileLengthKey
 * @param fileDataKey
 * @param field
 * @param blockSize
 */
@Override
public void deleteFile(String fileLengthKey, String fileDataKey, String field, long blockSize) {
    Jedis jedis = null;
    try {
        jedis = jedisPool.getResource();
        Pipeline pipelined = jedis.pipelined();
        //delete file length
        pipelined.hdel(fileLengthKey.getBytes(), field.getBytes());
        //delete file content
        for (int i = 0; i < blockSize; i++) {
            byte[] blockName = getBlockName(field, i);
            pipelined.hdel(fileDataKey.getBytes(), blockName);
        }
        pipelined.sync();
    } finally {
        jedis.close();
    }
}
 
Example 3
Source File: Battle.java    From gameserver with Apache License 2.0 6 votes vote down vote up
/**
 * After the Battle's reward is processed, the battle ends and all
 * data in Redis should be cleaned.
 * 
 * @param status
 */
public void battleEnd() {
	Pipeline pipeline = JedisFactory.getJedis().pipelined();
	
	Collection<BattleUser> battleUsers = battleUserMap.values();
	
	for (Iterator<BattleUser> iterator = battleUsers.iterator(); iterator.hasNext();) {
		BattleUser battleUser = iterator.next();
		if ( !battleUser.isLeaveBattle() ) {
			pipeline.hdel(battleUser.getUserSessionKey().toString(), BATTLE_SERVER_KEY);
			pipeline.hdel(battleUser.getUserSessionKey().toString(), BATTLE_SESSION_KEY);
		}
	}
	
	pipeline.sync();

}
 
Example 4
Source File: JedisStream.java    From RedisDirectory with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteFile(String fileLengthKey, String fileDataKey, String field, long blockSize) {
    Jedis jedis = openJedis();
    Pipeline pipelined = jedis.pipelined();
    //delete file length
    pipelined.hdel(fileLengthKey.getBytes(), field.getBytes());
    //delete file content
    for (int i = 0; i < blockSize; i++) {
        byte[] blockName = getBlockName(field, i);
        pipelined.hdel(fileDataKey.getBytes(), blockName);
    }
    pipelined.sync();
    jedis.close();
}
 
Example 5
Source File: JedisStream.java    From RedisDirectory with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteFile(String fileLengthKey, String fileDataKey, String field, long blockSize) {
    Jedis jedis = openJedis();
    Pipeline pipelined = jedis.pipelined();
    //delete file length
    pipelined.hdel(fileLengthKey.getBytes(), field.getBytes());
    //delete file content
    for (int i = 0; i < blockSize; i++) {
        byte[] blockName = getBlockName(field, i);
        pipelined.hdel(fileDataKey.getBytes(), blockName);
    }
    pipelined.sync();
    jedis.close();
}
 
Example 6
Source File: RedisUtil.java    From RedisBungee with Eclipse Public License 1.0 5 votes vote down vote up
public static void cleanUpPlayer(String player, Pipeline rsc) {
    rsc.srem("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", player);
    rsc.hdel("player:" + player, "server", "ip", "proxy");
    long timestamp = System.currentTimeMillis();
    rsc.hset("player:" + player, "online", String.valueOf(timestamp));
    rsc.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
            UUID.fromString(player), DataManager.DataManagerMessage.Action.LEAVE,
            new DataManager.LogoutPayload(timestamp))));
}