當前位置: 首頁>>代碼示例>>Java>>正文


Java Pipeline.publish方法代碼示例

本文整理匯總了Java中redis.clients.jedis.Pipeline.publish方法的典型用法代碼示例。如果您正苦於以下問題:Java Pipeline.publish方法的具體用法?Java Pipeline.publish怎麽用?Java Pipeline.publish使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在redis.clients.jedis.Pipeline的用法示例。


在下文中一共展示了Pipeline.publish方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: pipelineWithPubSub

import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
@Test
public void pipelineWithPubSub() {
  Pipeline pipelined = jedis.pipelined();
  Response<Long> p1 = pipelined.publish("foo", "bar");
  Response<Long> p2 = pipelined.publish("foo".getBytes(), "bar".getBytes());
  pipelined.sync();
  assertEquals(0, p1.get().longValue());
  assertEquals(0, p2.get().longValue());
}
 
開發者ID:sohutv,項目名稱:cachecloud,代碼行數:10,代碼來源:PipeliningTest.java

示例2: createPlayer

import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
protected static void createPlayer(PendingConnection connection, Pipeline pipeline, boolean fireEvent) {
    Map<String, String> playerData = new HashMap<>(4);
    playerData.put("online", "0");
    playerData.put("ip", connection.getAddress().getAddress().getHostAddress());
    playerData.put("proxy", RedisBungee.getConfiguration().getServerId());

    pipeline.sadd("proxy:" + RedisBungee.getApi().getServerId() + ":usersOnline", connection.getUniqueId().toString());
    pipeline.hmset("player:" + connection.getUniqueId().toString(), playerData);

    if (fireEvent) {
        pipeline.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
                connection.getUniqueId(), DataManager.DataManagerMessage.Action.JOIN,
                new DataManager.LoginPayload(connection.getAddress().getAddress()))));
    }
}
 
開發者ID:minecrafter,項目名稱:RedisBungee,代碼行數:16,代碼來源:RedisUtil.java

示例3: cleanUpPlayer

import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
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))));
}
 
開發者ID:minecrafter,項目名稱:RedisBungee,代碼行數:10,代碼來源:RedisUtil.java


注:本文中的redis.clients.jedis.Pipeline.publish方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。