Skip to content

Commit 965e64e

Browse files
Version Packages (#257)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 147f820 commit 965e64e

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

.changeset/plenty-cooks-bathe.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# @apollo/datasource-rest
22

3+
## 6.2.0
4+
5+
### Minor Changes
6+
7+
- [#185](https://github.com/apollographql/datasource-rest/pull/185) [`147f820`](https://github.com/apollographql/datasource-rest/commit/147f820c4a0c8272e7873cef4d6e4c9dddc22381) Thanks [@HishamAli81](https://github.com/HishamAli81)! - Added support to the RESTDatasource to be able to specify a custom cache set options type. The cache set options may need to be customized to include additional set options supported by the underlying key value cache implementation.
8+
9+
For example, if the [InMemoryLRUCache](https://github.com/apollographql/apollo-utils/blob/main/packages/keyValueCache/src/InMemoryLRUCache.ts) is being used to cache HTTP responses, then `noDisposeOnSet`, `noUpdateTTL`, etc cache options can be provided to the LRU cache:
10+
11+
```typescript
12+
import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache';
13+
14+
interface CustomCacheOptions {
15+
ttl?: number;
16+
noDisposeOnSet?: boolean;
17+
}
18+
19+
class ExampleDataSource extends RESTDataSource<CustomCacheOptions> {
20+
override baseURL = 'https://api.example.com';
21+
22+
constructor() {
23+
super({ cache: new InMemoryLRUCache() });
24+
}
25+
26+
getData(id: number) {
27+
return this.get(`data/${id}`, {
28+
cacheOptions: { ttl: 3600, noDisposeOnSet: true },
29+
});
30+
}
31+
}
32+
```
33+
334
## 6.1.1
435

536
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@apollo/datasource-rest",
33
"description": "REST DataSource for Apollo Server v4",
4-
"version": "6.1.1",
4+
"version": "6.2.0",
55
"author": "Apollo <[email protected]>",
66
"license": "MIT",
77
"repository": {

0 commit comments

Comments
 (0)