Package org.jredis

Examples of org.jredis.ZSetEntry


      for(int j=0; j<subset.size(); j++) {
        // ZSetEntry uses byte[] as baseline for value
        // since we know we put Strings in the set, we can go ahead and decode the byte[] and get our String value back
        // value is just a double (primitive). 
       
        ZSetEntry e = subset.get(j);
        String value = DefaultCodec.toStr(e.getValue());
       
        System.out.format("\t[%03d]:  {value: %s score: %1.19f}\n", j, value, e.getScore());
      }
     
      // & now let's get the subset in range {0, 10} in ascending order
      //
      List<ZSetEntry> revsubset = jredis.zrevrangeSubset(zset, 0, 10);
     
      System.out.format ("\n\n%s elements from 0 to 10 - reverse order:\n\t---\n", zset);
      for(int j=0; j<revsubset.size(); j++) {
        ZSetEntry e = revsubset.get(j);
        String value = DefaultCodec.toStr(e.getValue());
       
        System.out.format("\t[%03d]:  {value: %s score: %1.19f}\n", 100-j, value, e.getScore());
      }     
        }
        catch (RedisException e) { e.printStackTrace(); }
  }
View Full Code Here


      for(int j=0; j<subset.size(); j++) {
        // ZSetEntry uses byte[] as baseline for value
        // since we know we put Strings in the set, we can go ahead and decode the byte[] and get our String value back
        // value is just a double (primitive). 
       
        ZSetEntry e = subset.get(j);
        String value = DefaultCodec.toStr(e.getValue());
       
        System.out.format("\t[%03d]:  {value: %s score: %1.19f}\n", j, value, e.getScore());
      }
     
      // & now let's get the subset in range {0, 10} in ascending order
      //
      List<ZSetEntry> revsubset = futureRevSubset.get();
     
      System.out.format ("\n\n%s elements from 0 to 10 - reverse order:\n\t---\n", zset);
      for(int j=0; j<revsubset.size(); j++) {
        ZSetEntry e = revsubset.get(j);
        String value = DefaultCodec.toStr(e.getValue());
       
        System.out.format("\t[%03d]:  {value: %s score: %1.19f}\n", 100-j, value, e.getScore());
      }     
        }
        catch (ExecutionException e) {
          e.printStackTrace();
        }
        catch (InterruptedException e) {
          e.printStackTrace();
        }
  }
View Full Code Here

TOP

Related Classes of org.jredis.ZSetEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.