Skip to content

Commit d65f283

Browse files
committed
bugfix: overload methods for back compat
1 parent 8eb3e26 commit d65f283

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

src/com/danga/MemCached/MemCachedClient.java

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,23 @@ public Object get(String key) {
877877
return get( key, null, false );
878878
}
879879

880+
/**
881+
* Retrieve a key from the server, using a specific hash.
882+
*
883+
* If the data was compressed or serialized when compressed, it will automatically<br/>
884+
* be decompressed or serialized, as appropriate. (Inclusive or)<br/>
885+
*<br/>
886+
* Non-serialized data will be returned as a string, so explicit conversion to<br/>
887+
* numeric types will be necessary, if desired<br/>
888+
*
889+
* @param key key where data is stored
890+
* @param hashCode if not null, then the int hashcode to use
891+
* @return the object that was previously stored, or null if it was not previously stored
892+
*/
893+
public Object get( String key, Integer hashCode ) {
894+
return get( key, hashCode, false );
895+
}
896+
880897
/**
881898
* Retrieve a key from the server, using a specific hash.
882899
*
@@ -888,6 +905,7 @@ public Object get(String key) {
888905
*
889906
* @param key key where data is stored
890907
* @param hashCode if not null, then the int hashcode to use
908+
* @param asString if true, then return string val
891909
* @return the object that was previously stored, or null if it was not previously stored
892910
*/
893911
public Object get( String key, Integer hashCode, boolean asString ) {
@@ -949,7 +967,7 @@ public Object get( String key, Integer hashCode, boolean asString ) {
949967
* @return Object array ordered in same order as key array containing results
950968
*/
951969
public Object[] getMultiArray( String[] keys ) {
952-
return getMultiArray( keys, null );
970+
return getMultiArray( keys, null, false );
953971
}
954972

955973
/**
@@ -963,8 +981,23 @@ public Object[] getMultiArray( String[] keys ) {
963981
* @return Object array ordered in same order as key array containing results
964982
*/
965983
public Object[] getMultiArray( String[] keys, Integer[] hashCodes ) {
984+
return getMultiArray( keys, hashCodes, false );
985+
}
966986

967-
Map data = getMulti( keys, hashCodes, false );
987+
/**
988+
* Retrieve multiple objects from the memcache.
989+
*
990+
* This is recommended over repeated calls to {@link #get(String) get()}, since it<br/>
991+
* is more efficient.<br/>
992+
*
993+
* @param keys String array of keys to retrieve
994+
* @param hashCodes if not null, then the Integer array of hashCodes
995+
* @param asString if true, retrieve string vals
996+
* @return Object array ordered in same order as key array containing results
997+
*/
998+
public Object[] getMultiArray( String[] keys, Integer[] hashCodes, boolean asString ) {
999+
1000+
Map data = getMulti( keys, hashCodes, asString );
9681001

9691002
Object[] res = new Object[keys.length];
9701003
for (int i = 0; i < keys.length; i++) {
@@ -1001,6 +1034,23 @@ public Map getMulti( String[] keys ) {
10011034
* keys that are not found are not entered into the hashmap, but attempting to
10021035
* retrieve them from the hashmap gives you null.
10031036
*/
1037+
public Map getMulti( String[] keys, Integer[] hashCodes ) {
1038+
return getMulti( keys, hashCodes, false );
1039+
}
1040+
1041+
/**
1042+
* Retrieve multiple keys from the memcache.
1043+
*
1044+
* This is recommended over repeated calls to {@link #get(String) get()}, since it<br/>
1045+
* is more efficient.<br/>
1046+
*
1047+
* @param keys keys to retrieve
1048+
* @param hashCodes if not null, then the Integer array of hashCodes
1049+
* @param asString if true then retrieve using String val
1050+
* @return a hashmap with entries for each key is found by the server,
1051+
* keys that are not found are not entered into the hashmap, but attempting to
1052+
* retrieve them from the hashmap gives you null.
1053+
*/
10041054
public Map getMulti( String[] keys, Integer[] hashCodes, boolean asString ) {
10051055
Map sockKeys = new HashMap();
10061056

0 commit comments

Comments
 (0)