Merge commit 'origin/master' into key-tags
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
|
||||||
group = 'redis.clients'
|
group = 'com.googlecode.jedis'
|
||||||
archiveBaseName = 'jedis'
|
archiveBaseName = 'jedis'
|
||||||
version = '1.2.0'
|
version = '1.2.0'
|
||||||
|
|
||||||
|
|||||||
110
pom.xml
110
pom.xml
@@ -1,43 +1,77 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<groupId>redis.clients</groupId>
|
|
||||||
<artifactId>jedis</artifactId>
|
<parent>
|
||||||
<version>1.2.0</version>
|
<groupId>org.sonatype.oss</groupId>
|
||||||
<dependencies>
|
<artifactId>oss-parent</artifactId>
|
||||||
<dependency>
|
<version>5</version>
|
||||||
<groupId>junit</groupId>
|
</parent>
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.8.1</version>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<type>jar</type>
|
<packaging>jar</packaging>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
<groupId>com.googlecode.jedis</groupId>
|
||||||
</dependencies>
|
<artifactId>jedis</artifactId>
|
||||||
|
<version>1.2.0</version>
|
||||||
<properties>
|
|
||||||
<redis-hosts>localhost:6379,localhost:6380</redis-hosts>
|
<name>Jedis</name>
|
||||||
</properties>
|
<description>Jedis is a blazingly small and sane Redis java client.</description>
|
||||||
|
<url>http://code.google.com/p/jedis/</url>
|
||||||
<build>
|
|
||||||
<plugins>
|
<licenses>
|
||||||
<plugin>
|
<license>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<name>Jedis License</name>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<url>http://github.com/xetorthio/jedis/raw/master/LICENSE.txt</url>
|
||||||
<version>2.0.2</version>
|
<distribution>repo</distribution>
|
||||||
<configuration>
|
</license>
|
||||||
<source>1.6</source>
|
</licenses>
|
||||||
<target>1.6</target>
|
|
||||||
</configuration>
|
<issueManagement>
|
||||||
</plugin>
|
<system>github</system>
|
||||||
<plugin>
|
<url>http://github.com/xetorthio/jedis/issues</url>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</issueManagement>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.6</version>
|
<scm>
|
||||||
<configuration>
|
<url>http://github.com/xetorthio/jedis</url>
|
||||||
|
<connection>scm:git:http://github.com/xetorthio/jedis.git</connection>
|
||||||
|
<developerConnection>scm:git:http://github.com/xetorthio/jedis.git</developerConnection>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<redis-hosts>localhost:6379,localhost:6380</redis-hosts>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.8.1</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<redis-hosts>${redis-hosts}</redis-hosts>
|
<redis-hosts>${redis-hosts}</redis-hosts>
|
||||||
</systemPropertyVariables>
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,46 +5,115 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder Class for {@link Jedis#sort(String, SortingParams) SORT} Parameters.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class SortingParams {
|
public class SortingParams {
|
||||||
private List<String> params = new ArrayList<String>();
|
private List<String> params = new ArrayList<String>();
|
||||||
|
|
||||||
public SortingParams by(String pattern) {
|
/**
|
||||||
params.add("BY");
|
* Sort by weight in keys.
|
||||||
params.add(pattern);
|
* <p>
|
||||||
return this;
|
* Takes a pattern that is used in order to generate the key names of the
|
||||||
}
|
* weights used for sorting. Weight key names are obtained substituting the
|
||||||
|
* first occurrence of * with the actual value of the elements on the list.
|
||||||
public Collection<String> getParams() {
|
* <p>
|
||||||
return Collections.unmodifiableCollection(params);
|
* The pattern for a normal key/value pair is "keyname*" and for a value in
|
||||||
}
|
* a hash "keyname*->fieldname".
|
||||||
|
*
|
||||||
public SortingParams desc() {
|
* @param pattern
|
||||||
params.add("DESC");
|
* @return the SortingParams Object
|
||||||
return this;
|
*/
|
||||||
}
|
public SortingParams by(String pattern) {
|
||||||
|
params.add("BY");
|
||||||
public SortingParams asc() {
|
params.add(pattern);
|
||||||
params.add("ASC");
|
return this;
|
||||||
return this;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
public SortingParams limit(int start, int count) {
|
* No sorting.
|
||||||
params.add("LIMIT");
|
* <p>
|
||||||
params.add(String.valueOf(start));
|
* This is useful if you want to retrieve a external key (using
|
||||||
params.add(String.valueOf(count));
|
* {@link #get(String...) GET}) but you don't want the sorting overhead.
|
||||||
return this;
|
*
|
||||||
}
|
* @return the SortingParams Object
|
||||||
|
*/
|
||||||
public SortingParams alpha() {
|
public SortingParams nosort() {
|
||||||
params.add("ALPHA");
|
params.add("BY nosort");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortingParams get(String... patterns) {
|
public Collection<String> getParams() {
|
||||||
for (String pattern : patterns) {
|
return Collections.unmodifiableCollection(params);
|
||||||
params.add("GET");
|
}
|
||||||
params.add(pattern);
|
|
||||||
|
/**
|
||||||
|
* Get the Sorting in Descending Order.
|
||||||
|
*
|
||||||
|
* @return the sortingParams Object
|
||||||
|
*/
|
||||||
|
public SortingParams desc() {
|
||||||
|
params.add("DESC");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Sorting in Ascending Order. This is the default order.
|
||||||
|
*
|
||||||
|
* @return the SortingParams Object
|
||||||
|
*/
|
||||||
|
public SortingParams asc() {
|
||||||
|
params.add("ASC");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limit the Numbers of returned Elements.
|
||||||
|
*
|
||||||
|
* @param start
|
||||||
|
* is zero based
|
||||||
|
* @param count
|
||||||
|
* @return the SortingParams Object
|
||||||
|
*/
|
||||||
|
public SortingParams limit(int start, int count) {
|
||||||
|
params.add("LIMIT");
|
||||||
|
params.add(String.valueOf(start));
|
||||||
|
params.add(String.valueOf(count));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort lexicographicaly. Note that Redis is utf-8 aware assuming you set
|
||||||
|
* the right value for the LC_COLLATE environment variable.
|
||||||
|
*
|
||||||
|
* @return the SortingParams Object
|
||||||
|
*/
|
||||||
|
public SortingParams alpha() {
|
||||||
|
params.add("ALPHA");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieving external keys from the result of the search.
|
||||||
|
* <p>
|
||||||
|
* Takes a pattern that is used in order to generate the key names of the
|
||||||
|
* result of sorting. The key names are obtained substituting the
|
||||||
|
* first occurrence of * with the actual value of the elements on the list.
|
||||||
|
* <p>
|
||||||
|
* The pattern for a normal key/value pair is "keyname*" and for a value in
|
||||||
|
* a hash "keyname*->fieldname".
|
||||||
|
* <p>
|
||||||
|
* To get the list itself use the char # as pattern.
|
||||||
|
*
|
||||||
|
* @param patterns
|
||||||
|
* @return the SortingParams Object
|
||||||
|
*/
|
||||||
|
public SortingParams get(String... patterns) {
|
||||||
|
for (String pattern : patterns) {
|
||||||
|
params.add("GET");
|
||||||
|
params.add(pattern);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user