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


Java Transaction.get方法代码示例

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


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

示例1: testResetStateWithFullyExecutedTransaction

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test
public void testResetStateWithFullyExecutedTransaction() {
  Jedis jedis2 = new Jedis(jedis.getClient().getHost(), jedis.getClient().getPort());
  jedis2.auth("foobared");

  Transaction t = jedis2.multi();
  t.set("mykey", "foo");
  t.get("mykey");

  List<Object> resp = t.exec();
  assertNotNull(resp);
  assertEquals(2, resp.size());

  jedis2.resetState();
  jedis2.close();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:17,代码来源:TransactionCommandsTest.java

示例2: transactionResponseWithError

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test
public void transactionResponseWithError() {
  Transaction t = jedis.multi();
  t.set("foo", "bar");
  Response<Set<String>> error = t.smembers("foo");
  Response<String> r = t.get("foo");
  List<Object> l = t.exec();
  assertEquals(JedisDataException.class, l.get(1).getClass());
  try {
    error.get();
    fail("We expect exception here!");
  } catch (JedisDataException e) {
    // that is fine we should be here
  }
  assertEquals(r.get(), "bar");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:17,代码来源:TransactionCommandsTest.java

示例3: execGetResponse

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test
public void execGetResponse() {
  Transaction t = jedis.multi();

  t.set("foo", "bar");
  t.smembers("foo");
  t.get("foo");

  List<Response<?>> lr = t.execGetResponse();
  try {
    lr.get(1).get();
    fail("We expect exception here!");
  } catch (JedisDataException e) {
    // that is fine we should be here
  }
  assertEquals("bar", lr.get(2).get());
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:18,代码来源:TransactionCommandsTest.java

示例4: remove

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Override
public <E extends EntityType, T extends TokenType> AuthenticationToken<E, T> remove(final TokenProxy<E, T> tokenProxy) throws IOException {
    try(final Jedis jedis = jedisPool.getResource()) {
        final byte[] keyBytes = serialize(tokenProxy);

        final Transaction transaction = jedis.multi();

        final Response<byte[]> oldTokenResponse = transaction.get(keyBytes);
        transaction.del(keyBytes);

        transaction.exec();

        //noinspection unchecked
        return (AuthenticationToken<E, T>) deserialize(oldTokenResponse.get());
    }
}
 
开发者ID:hpe-idol,项目名称:redis-hod-token-repository,代码行数:17,代码来源:RedisTokenRepository.java

示例5: transactionResponseWithinPipeline

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test(expected = JedisDataException.class)
public void transactionResponseWithinPipeline() {
  jedis.set("string", "foo");

  Transaction t = jedis.multi();
  Response<String> string = t.get("string");
  string.get();
  t.exec();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:TransactionCommandsTest.java

示例6: getSet

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
public String getSet(String chave, String novoValor) {
	Jedis jedis = new Jedis("localhost");
	Transaction transaction = jedis.multi();

	transaction.get(chave);
	transaction.set(chave, novoValor);

	List<Object> resultados = transaction.exec();

	return (String) resultados.get(0);
}
 
开发者ID:rlazoti,项目名称:exemplos-livro-redis,代码行数:12,代码来源:ExecutarGetSetEmTransacao.java

示例7: update

import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Override
public <E extends EntityType, T extends TokenType> AuthenticationToken<E, T> update(final TokenProxy<E, T> tokenProxy, final AuthenticationToken<E, T> authenticationToken) throws IOException {
    checkTokenExpiry(authenticationToken);

    try(final Jedis jedis = jedisPool.getResource()) {
        final byte[] keyBytes = serialize(tokenProxy);

        final Transaction transaction = jedis.multi();

        final Response<byte[]> oldTokenResponse = transaction.get(keyBytes);

        transaction.set(keyBytes, serialize(authenticationToken), "XX".getBytes(), "EX".getBytes(), getExpirySeconds(authenticationToken.getExpiry()));

        transaction.exec();

        //noinspection unchecked
        return (AuthenticationToken<E, T>) deserialize(oldTokenResponse.get());
    }
}
 
开发者ID:hpe-idol,项目名称:redis-hod-token-repository,代码行数:20,代码来源:RedisTokenRepository.java


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