Skip to content

Commit

Permalink
docs: simplify README
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshaf committed Nov 26, 2024
1 parent 73171f6 commit a4bce1a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,18 @@ Integrate idb-cache as an AsyncStorage persister for TanStack Query.

```typescript
import { QueryClient } from '@tanstack/query-core';
import { experimental_createPersister } from '@tanstack/query-persist-client-core';
import { IDBCache } from 'idb-cache';

const cacheBuster = 'my_salt'; // Doubles as salt for encryption
import { experimental_createPersister as createPersister } from '@tanstack/query-persist-client-core';
import { IDBCache } from '@instructure/idb-cache';

const idbCache = new IDBCache({
cacheKey: 'user_cache_key',
cacheBuster,
});

// Create the persister
const persister = experimental_createPersister({
const persister = createPersister({
storage: idbCache,
maxAge: 1000 * 60 * 60 * 24 * 7, // 7 days
buster: cacheBuster,
});

// Initialize the QueryClient with the persister
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
Expand All @@ -105,6 +99,8 @@ export const queryClient = new QueryClient({
},
},
});


```

## Data flow
Expand Down

0 comments on commit a4bce1a

Please sign in to comment.