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


Java Pipeline.del方法代码示例

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


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

示例1: remove

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void remove(@NonNull String id) {
  try (Jedis jedis = jedisSource.getJedis()) {
    Map<String, String> userRolesById = jedis.hgetAll(userKey(id, ResourceType.ROLE));

    Pipeline p = jedis.pipelined();

    p.srem(allUsersKey(), id);
    for (String roleName : userRolesById.keySet()) {
      p.srem(roleKey(roleName), id);
    }

    for (ResourceType r : ResourceType.values()) {
      p.del(userKey(id, r));
    }
    p.sync();
  } catch (Exception e) {
    log.error("Storage exception reading " + id + " entry.", e);
  }
}
 
开发者ID:spinnaker,项目名称:fiat,代码行数:21,代码来源:RedisPermissionsRepository.java

示例2: removeCalendar

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
/**
 * Remove (delete) the <code>{@link org.quartz.Calendar}</code> with the given name.
 * @param calendarName the name of the calendar to be removed
 * @param jedis a thread-safe Redis connection
 * @return true if a calendar with the given name was found and removed
 */
@Override
public boolean removeCalendar(String calendarName, Jedis jedis) throws JobPersistenceException {
    final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(calendarName);

    if(jedis.scard(calendarTriggersSetKey) > 0){
        throw new JobPersistenceException(String.format("There are triggers pointing to calendar %s, so it cannot be removed.", calendarName));
    }
    final String calendarHashKey = redisSchema.calendarHashKey(calendarName);
    Pipeline pipe = jedis.pipelined();
    Response<Long> deleteResponse = pipe.del(calendarHashKey);
    pipe.srem(redisSchema.calendarsSet(), calendarHashKey);
    pipe.sync();

    return deleteResponse.get() == 1;
}
 
开发者ID:jlinn,项目名称:quartz-redis-jobstore,代码行数:22,代码来源:RedisStorage.java

示例3: registerFakeSession

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
private void registerFakeSession(int count, User user) {
	//Clean all sessions
	Jedis jedis = JedisFactory.getJedis();
	Pipeline pipeline = jedis.pipelined();
	Set<byte[]> strs = jedis.keys("*".getBytes());
	for ( byte[] key : strs ) {
		pipeline.del(key);
	}
	pipeline.sync();
	
	UserId userId = user.get_id();
	SessionKey sessionKey = SessionKey.createSessionKeyFromRandomString();
	user.setSessionKey(sessionKey);
	
	//Store it with machineid to redis
	jedis = JedisFactory.getJedis();
	pipeline = jedis.pipelined();
	for ( int i=0; i<count; i++ ) {
		pipeline.hset(sessionKey.toString(), SessionManager.H_MACHINE_KEY, "localhost:10000");
		pipeline.hset(userId.toString(), SessionManager.H_MACHINE_KEY, "localhost:10000");
		pipeline.hset(userId.toString(), SessionManager.H_SESSION_KEY, sessionKey.toString());
	}
	pipeline.sync();
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:25,代码来源:BceChatHandlerTest.java

示例4: resetChannels

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
public void resetChannels(final Set<String> channels) {

        Handle handle = rdbi.open();

        try {
            Pipeline pipeline = handle.jedis().pipelined();

            for (String channel : channels) {
                pipeline.del(channel + ":queue");
                pipeline.del(channel + ":depth");
            }
            pipeline.sync();
        } finally {
            handle.close();
        }
    }
 
开发者ID:lithiumtech,项目名称:rdbi,代码行数:17,代码来源:ChannelPublisher.java

示例5: doDeleteRecord

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
private void doDeleteRecord(Record record, List<ErrorRecord> tempRecords, Pipeline pipeline, String key)
        throws StageException {
  if (!StringUtils.isEmpty(key)) {
    pipeline.del(key);
    tempRecords.add(new ErrorRecord(record, "Delete", key, ""));
  } else {
    LOG.error(Errors.REDIS_09.getMessage(), key);
    errorRecordHandler.onError(
            new OnRecordErrorException(
                    record,
                    Errors.REDIS_09
            )
    );
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:16,代码来源:RedisTarget.java

示例6: deleteAllKeys

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
/**
 * Use it with caution. 
 * It delete all the keys from Redis
 */
public static final void deleteAllKeys(Jedis jedis) {
	Pipeline pipeline = jedis.pipelined();
	Set<byte[]> bytes = jedis.keys("*".getBytes());
	for ( byte[] key : bytes ) {
		pipeline.del(key);
	}
	pipeline.sync();
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:13,代码来源:JedisUtil.java

示例7: testClean

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
public void testClean() {
	com.xinqihd.sns.gameserver.jedis.Jedis jedis = JedisFactory.getJedis();
	Set<String> strs = jedis.keys("*");
	Pipeline pipeline = jedis.pipelined();
	for ( String key : strs ) {
		pipeline.del(key);
	}
	pipeline.sync();
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:10,代码来源:JedisTest.java

示例8: clobberThings

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@BeforeMethod
public void clobberThings() {
    final RDBI rdbi = new RDBI(new JedisPool("localhost"));
    try (final Handle h = rdbi.open()) {
        final Set<String> keys = h.jedis().keys(cachePrefix + "*");
        final Pipeline pipeline = h.jedis().pipelined();
        for (final String key : keys) {
            pipeline.del(key);
        }
        pipeline.sync();
    }
}
 
开发者ID:lithiumtech,项目名称:rdbi,代码行数:13,代码来源:RedisMapTest.java

示例9: setLastEntries

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void setLastEntries(Feed feed, List<String> entries) {
	try (Jedis jedis = pool.getResource()) {
		String key = buildRedisEntryKey(feed);

		Pipeline pipe = jedis.pipelined();
		pipe.del(key);
		for (String entry : entries) {
			pipe.sadd(key, entry);
		}
		pipe.expire(key, (int) TimeUnit.DAYS.toSeconds(7));
		pipe.sync();
	}
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:15,代码来源:RedisCacheService.java

示例10: setUserRootCategory

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void setUserRootCategory(User user, Category category) {
	try (Jedis jedis = pool.getResource()) {
		String key = buildRedisUserRootCategoryKey(user);

		Pipeline pipe = jedis.pipelined();
		pipe.del(key);
		pipe.set(key, MAPPER.writeValueAsString(category));
		pipe.expire(key, (int) TimeUnit.MINUTES.toSeconds(30));
		pipe.sync();
	} catch (JsonProcessingException e) {
		log.error(e.getMessage(), e);
	}
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:15,代码来源:RedisCacheService.java

示例11: setUnreadCount

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void setUnreadCount(FeedSubscription sub, UnreadCount count) {
	try (Jedis jedis = pool.getResource()) {
		String key = buildRedisUnreadCountKey(sub);

		Pipeline pipe = jedis.pipelined();
		pipe.del(key);
		pipe.set(key, MAPPER.writeValueAsString(count));
		pipe.expire(key, (int) TimeUnit.MINUTES.toSeconds(30));
		pipe.sync();
	} catch (Exception e) {
		log.error(e.getMessage(), e);
	}
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:15,代码来源:RedisCacheService.java

示例12: invalidateUserRootCategory

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void invalidateUserRootCategory(User... users) {
	try (Jedis jedis = pool.getResource()) {
		Pipeline pipe = jedis.pipelined();
		if (users != null) {
			for (User user : users) {
				String key = buildRedisUserRootCategoryKey(user);
				pipe.del(key);
			}
		}
		pipe.sync();
	}
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:14,代码来源:RedisCacheService.java

示例13: invalidateUnreadCount

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public void invalidateUnreadCount(FeedSubscription... subs) {
	try (Jedis jedis = pool.getResource()) {
		Pipeline pipe = jedis.pipelined();
		if (subs != null) {
			for (FeedSubscription sub : subs) {
				String key = buildRedisUnreadCountKey(sub);
				pipe.del(key);
			}
		}
		pipe.sync();
	}
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:14,代码来源:RedisCacheService.java

示例14: put

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
@Override
public RedisPermissionsRepository put(@NonNull UserPermission permission) {
  Map<ResourceType, Map<String, String>> resourceTypeToRedisValue =
      new HashMap<>(ResourceType.values().length);

  permission
      .getAllResources()
      .forEach(resource -> {
        try {
          resourceTypeToRedisValue
              .computeIfAbsent(resource.getResourceType(), key -> new HashMap<>())
              .put(resource.getName(), objectMapper.writeValueAsString(resource));
        } catch (JsonProcessingException jpe) {
          log.error("Serialization exception writing " + permission.getId() + " entry.", jpe);
        }
      });

  try (Jedis jedis = jedisSource.getJedis()) {
    Pipeline deleteOldValuesPipeline = jedis.pipelined();
    Pipeline insertNewValuesPipeline = jedis.pipelined();

    String userId = permission.getId();
    insertNewValuesPipeline.sadd(allUsersKey(), userId);

    permission.getRoles().forEach(role -> insertNewValuesPipeline.sadd(roleKey(role), userId));

    for (ResourceType r : ResourceType.values()) {
      String userResourceKey = userKey(userId, r);

      deleteOldValuesPipeline.del(userResourceKey);

      Map<String, String> redisValue = resourceTypeToRedisValue.get(r);
      if (redisValue != null && !redisValue.isEmpty()) {
        insertNewValuesPipeline.hmset(userResourceKey, redisValue);
      }
    }
    deleteOldValuesPipeline.sync();
    insertNewValuesPipeline.sync();
  } catch (Exception e) {
    log.error("Storage exception writing " + permission.getId() + " entry.", e);
  }
  return this;
}
 
开发者ID:spinnaker,项目名称:fiat,代码行数:44,代码来源:RedisPermissionsRepository.java

示例15: removeJob

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
/**
 * Remove the given job from Redis
 * @param jobKey the job to be removed
 * @param jedis a thread-safe Redis connection
 * @return true if the job was removed; false if it did not exist
 */
@Override
public boolean removeJob(JobKey jobKey, Jedis jedis) throws JobPersistenceException {
    final String jobHashKey = redisSchema.jobHashKey(jobKey);
    final String jobBlockedKey = redisSchema.jobBlockedKey(jobKey);
    final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);
    final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobKey);
    final String jobTriggerSetKey = redisSchema.jobTriggersSetKey(jobKey);

    Pipeline pipe = jedis.pipelined();
    // remove the job and any associated data
    Response<Long> delJobHashKeyResponse = pipe.del(jobHashKey);
    // remove the blocked job key
    pipe.del(jobBlockedKey);
    // remove the job's data map
    pipe.del(jobDataMapHashKey);
    // remove the job from the set of all jobs
    pipe.srem(redisSchema.jobsSet(), jobHashKey);
    // remove the job from the set of blocked jobs
    pipe.srem(redisSchema.blockedJobsSet(), jobHashKey);
    // remove the job from its group
    pipe.srem(jobGroupSetKey, jobHashKey);
    // retrieve the keys for all triggers associated with this job, then delete that set
    Response<Set<String>> jobTriggerSetResponse = pipe.smembers(jobTriggerSetKey);
    pipe.del(jobTriggerSetKey);
    Response<Long> jobGroupSetSizeResponse = pipe.scard(jobGroupSetKey);
    pipe.sync();
    if(jobGroupSetSizeResponse.get() == 0){
        // The group now contains no jobs. Remove it from the set of all job groups.
        jedis.srem(redisSchema.jobGroupsSet(), jobGroupSetKey);
    }

    // remove all triggers associated with this job
    pipe = jedis.pipelined();
    for (String triggerHashKey : jobTriggerSetResponse.get()) {
        // get this trigger's TriggerKey
        final TriggerKey triggerKey = redisSchema.triggerKey(triggerHashKey);
        final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(triggerKey);
        unsetTriggerState(triggerHashKey, jedis);
        // remove the trigger from the set of all triggers
        pipe.srem(redisSchema.triggersSet(), triggerHashKey);
        // remove the trigger's group from the set of all trigger groups
        pipe.srem(redisSchema.triggerGroupsSet(), triggerGroupSetKey);
        // remove this trigger from its group
        pipe.srem(triggerGroupSetKey, triggerHashKey);
        // delete the trigger
        pipe.del(triggerHashKey);
    }
    pipe.sync();

    return delJobHashKeyResponse.get() == 1;
}
 
开发者ID:jlinn,项目名称:quartz-redis-jobstore,代码行数:58,代码来源:RedisStorage.java


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