예제 #1
0
  @Override
  public Long clear(final String pattern) throws IOException {
    return executor.execute(
        new RedisCallable<Long>() {

          @Override
          public Long call(Jedis jedis) throws Exception {
            List<String> keys = Arrays.asList(pattern);
            List<String> args = Arrays.asList();
            return (Long) jedis.evalsha(delsha, keys, args);
          }
        });
  }
예제 #2
0
  @Override
  public String load(String bundleName, String scriptName) throws IOException {
    Bundle b = Framework.getRuntime().getBundle(bundleName);
    URL loc = b.getEntry(scriptName + ".lua");
    InputStream is = loc.openStream();
    final StrBuilder builder = new StrBuilder();
    for (String line : IOUtils.readLines(is)) {
      builder.appendln(line);
    }
    return executor.execute(
        new RedisCallable<String>() {

          @Override
          public String call(Jedis jedis) throws Exception {
            return jedis.scriptLoad(builder.toString());
          }
        });
  }