Пример #1
0
  public CommandArgs<K, V> add(Map<K, V> map) {
    if (map.size() > 2) {
      realloc(buffer.capacity() + 16 * map.size());
    }

    for (Map.Entry<K, V> entry : map.entrySet()) {
      write(codec.encodeMapKey(entry.getKey()));
      write(codec.encodeMapValue(entry.getValue()));
    }

    return this;
  }
Пример #2
0
 public String digest(V script) {
   try {
     MessageDigest md = MessageDigest.getInstance("SHA1");
     md.update(codec.encodeValue(script));
     return new String(Base16.encode(md.digest(), false));
   } catch (NoSuchAlgorithmException e) {
     throw new RedisException("JVM does not support SHA1");
   }
 }
Пример #3
0
 public CommandArgs<K, V> addValue(V value) {
   return write(codec.encodeValue(value));
 }
Пример #4
0
 public CommandArgs<K, V> addKey(K key) {
   return write(codec.encodeKey(key));
 }