Skip to content

Commit

Permalink
Merge pull request #323 from sUpniverse/supniverse/mgets
Browse files Browse the repository at this point in the history
FEATURE: support mgets command
  • Loading branch information
jhpark816 authored Feb 9, 2021
2 parents 1c77f7d + 4e3dc21 commit 54a1106
Show file tree
Hide file tree
Showing 21 changed files with 710 additions and 128 deletions.
30 changes: 27 additions & 3 deletions docs/03-key-value-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,40 @@ future.get(key).getStatusCode() | 설명
--------------------------------| ---------
StatusCode.SUCCESS | 조회 성공(key에 해당하는 item 존재하지 않아도 성공)

여러 key들의 value들을 한번에 조회하는 bulk API를 제공한다.
여러 key들의 value를 한번에 조회하는 bulk API를 제공한다.

```java
BulkFuture<Map<String,Object>> asyncGetBulk(Collection<String> keys)
BulkFuture<Map<String,Object>> asyncGetBulk(String... keys)
BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys)
BulkFuture<Map<String, Object>> asyncGetBulk(String... keys)
```

- 다수 key들에 저장된 value를 Map<String, Object> 형태로 반환한다.
- 다수 key들은 String 유형의 Collection이거나 String 유형의 나열된 key 목록일 수 있다.

하나의 key를 가진 cache item에 저장된 CASValue를 조회하는 API를 제공한다.

```java
GetFuture<CASValue<Object>> asyncGets(String key)
```

- 주어진 key에 저장된 CASValue(cas, value)를 반환한다.

수행 결과는 future 객체를 통해 얻는다.

future.get(key).getStatusCode() | 설명
--------------------------------| ---------
StatusCode.SUCCESS | 조회 성공(key에 해당하는 item 존재하지 않아도 성공)

여러 key들의 CASValue를 한번에 조회하는 bulk API를 제공한다.

```java
BulkFuture<Map<String, CASValue<Object>>> asyncGetsBulk(Collection<String> keys)
BulkFuture<Map<String, CASValue<Object>>> asyncGetsBulk(String... keys)
```

- 다수 key들에 저장된 CASValue를 Map<String, CASValue<Object>> 형태로 반환한다.
- 다수 key들은 String 유형의 Collection이거나 String 유형의 나열된 key 목록일 수 있다.

## Key-Value Item 값의 증감

key-value item에서 value 부분의 값을 증가시키거나 감소시키는 연산이다.
Expand Down
43 changes: 43 additions & 0 deletions src/main/java/net/spy/memcached/ArcusClientPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,29 @@ public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
return this.getClient().asyncGetBulk(keys);
}

public <T> BulkFuture<Map<String, CASValue<T>>> asyncGetsBulk(Collection<String> keys,
Iterator<Transcoder<T>> tcs) {
return this.getClient().asyncGetsBulk(keys, tcs);
}

public <T> BulkFuture<Map<String, CASValue<T>>> asyncGetsBulk(Collection<String> keys,
Transcoder<T> tc) {
return this.getClient().asyncGetsBulk(keys, tc);
}

public BulkFuture<Map<String, CASValue<Object>>> asyncGetsBulk(Collection<String> keys) {
return this.getClient().asyncGetsBulk(keys);
}

public <T> BulkFuture<Map<String, CASValue<T>>> asyncGetsBulk(Transcoder<T> tc,
String... keys) {
return this.getClient().asyncGetsBulk(tc, keys);
}

public BulkFuture<Map<String, CASValue<Object>>> asyncGetsBulk(String... keys) {
return this.getClient().asyncGetsBulk(keys);
}

public <T> Map<String, T> getBulk(Collection<String> keys, Transcoder<T> tc)
throws OperationTimeoutException {
return this.getClient().getBulk(keys, tc);
Expand All @@ -230,6 +253,26 @@ public Map<String, Object> getBulk(String... keys)
return this.getClient().getBulk(keys);
}

public <T> Map<String, CASValue<T>> getsBulk(Collection<String> keys, Transcoder<T> tc)
throws OperationTimeoutException {
return this.getClient().getsBulk(keys, tc);
}

public Map<String, CASValue<Object>> getsBulk(Collection<String> keys)
throws OperationTimeoutException {
return this.getClient().getsBulk(keys);
}

public <T> Map<String, CASValue<T>> getsBulk(Transcoder<T> tc, String... keys)
throws OperationTimeoutException {
return this.getClient().getsBulk(tc, keys);
}

public Map<String, CASValue<Object>> getsBulk(String... keys)
throws OperationTimeoutException {
return this.getClient().getsBulk(keys);
}

public Map<SocketAddress, String> getVersions() {
return this.getClient().getVersions();
}
Expand Down
Loading

0 comments on commit 54a1106

Please sign in to comment.