Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement InMemoryCache garbage collection and eviction. #5310

Merged
merged 11 commits into from
Sep 13, 2019
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@

## Improvements

- `InMemoryCache` now supports tracing garbage collection and eviction. Note that the signature of the `evict` method has been simplified in a potentially backwards-incompatible way. <br/>
[@benjamn](https://github.com/benjamn) in [#5310](https://github.com/apollographql/apollo-client/pull/5310)

- Fully removed `prettier`. The Apollo Client team has decided to no longer automatically enforce code formatting across the codebase. In most cases existing code styles should be followed as much as possible, but this is not a hard and fast rule. <br/>
[@hwillson](https://github.com/hwillson) in [#5227](https://github.com/apollographql/apollo-client/pull/5227)

- Update the `fetchMore` type signature to accept `context`. <br/>
[@koenpunt](https://github.com/koenpunt) in [#5147](https://github.com/apollographql/apollo-client/pull/5147)

- Fix type for `Resolver` and use it in the definition of `Resolvers`. <br />
[@peoplenarthax](https://github.com/peoplenarthax) in [#4943](https://github.com/apollographql/apollo-client/pull/4943)

### Breaking Changes

- Removed `graphql-anywhere` since it's no longer used by Apollo Client. <br/>
[@hwillson](https://github.com/hwillson) in [#5159](https://github.com/apollographql/apollo-client/pull/5159)

- Removed `apollo-boost` since Apollo Client 3.0 provides a boost like getting started experience out of the box. <br/>
[@hwillson](https://github.com/hwillson) in [#5217](https://github.com/apollographql/apollo-client/pull/5217)


## Apollo Client (2.6.4)

### Apollo Client (2.6.4)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{
"name": "apollo-client",
"path": "./lib/apollo-client.cjs.min.js",
"maxSize": "16.55 kB"
"maxSize": "16.9 kB"
}
],
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions src/cache/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
): void;
public abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>;
public abstract watch(watch: Cache.WatchOptions): () => void;
public abstract evict<TVariables = any>(
query: Cache.EvictOptions<TVariables>,
): Cache.EvictionResult;
public abstract evict(dataId: string): boolean;
public abstract reset(): Promise<void>;

// intializer / offline / ssr API
Expand Down
8 changes: 0 additions & 8 deletions src/cache/core/types/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { DataProxy } from './DataProxy';

export namespace Cache {
export type WatchCallback = (newData: any) => void;
export interface EvictionResult {
success: Boolean;
}

export interface ReadOptions<TVariables = any>
extends DataProxy.Query<TVariables> {
Expand All @@ -27,11 +24,6 @@ export namespace Cache {
callback: WatchCallback;
}

export interface EvictOptions<TVariables = any>
extends DataProxy.Query<TVariables> {
rootId?: string;
}

export import DiffResult = DataProxy.DiffResult;
export import WriteQueryOptions = DataProxy.WriteQueryOptions;
export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;
Expand Down
Loading