Skip to content

Commit cac0674

Browse files
committed
better keyset()
1 parent fc96382 commit cac0674

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/main/java/picoded/dstack/redis/Redis_DataObjectMap.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ public void clear() {
150150
public void DataObjectRemoteDataMap_update(String _oid, Map<String, Object> fullMap,
151151
Set<String> updateKeys) {
152152

153-
//yus
154153
Map<String, Object> clonedMap = new HashMap<String, Object>();
155154

156155
// Lets iterate the keys, and decide accordingly
@@ -210,16 +209,20 @@ public Map<String, Object> DataObjectRemoteDataMap_get(String _oid) {
210209
/**
211210
* @return set of keys
212211
**/
213-
@Override
214-
public Set<String> keySet() {
212+
public Set<String> keySet(String value) {
215213
// The return hashset
216214
HashSet<String> ret = new HashSet<String>();
217-
215+
218216
//Fetch everything in current db
219217
RKeys keySet = redisson.getKeys();
220-
keySet.getKeysByPattern("_oid").forEach(k -> ret.add(k));
221-
222-
// Return the full keyset
218+
if (value != null) {
219+
// Return key where value is matched
220+
keySet.getKeysByPattern(value).forEach(k -> ret.add(k));
221+
}
222+
else {
223+
// Return the full keyset
224+
keySet.getKeys().forEach(k -> ret.add(k));
225+
}
223226
return ret;
224227
}
225228

0 commit comments

Comments
 (0)