chore: cleanup

This commit is contained in:
Joren Broekema 2021-02-18 10:59:55 +01:00 committed by Thomas Allmer
parent 15e2d13589
commit 28dbf3d232
2 changed files with 7 additions and 8 deletions

View file

@ -225,9 +225,9 @@ Alternatively, most often for subclassers, you can extend or import `AjaxClient`
```js
import { AjaxClient } from '@lion/ajax';
export const ajax = new AjaxClient({
cacheOptions: {
useCache: true,
export const ajax = new AjaxClient({
cacheOptions: {
useCache: true,
timeToLive: 1000 * 60 * 5, // 5 minutes
getCacheIdentifier: () => getActiveProfile().profileId,
},
@ -319,8 +319,8 @@ After TTL expires, the next request will set the cache again, and for the next 3
export const cacheTimeToLive = () => {
const actionLogger = renderLitAsNode(html`<sb-action-logger></sb-action-logger>`);
const fetchHandler = () => {
ajax.requestJson(`./packages/ajax/docs/pabu.json`, {
cacheOptions: {
ajax.requestJson(`./packages/ajax/docs/pabu.json`, {
cacheOptions: {
timeToLive: 1000 * 3, // 3 seconds
}
})
@ -441,7 +441,7 @@ export const invalidateRules = () => {
actionCacheOptions.invalidateUrlsRegex = /\/packages\/ajax\/docs\/naga.json/;
}
ajax.requestJson(`./packages/ajax/docs/${name}.json`, {
ajax.requestJson(`./packages/ajax/docs/${name}.json`, {
method,
cacheOptions: actionCacheOptions,
})
@ -463,4 +463,4 @@ export const invalidateRules = () => {
${actionLogger}
`;
}
```
```

View file

@ -253,7 +253,6 @@ export const cacheRequestInterceptorFactory = (getCacheIdentifier, globalCacheOp
if (cacheOptions.invalidateUrls) {
cacheOptions.invalidateUrls.forEach(
/** @type {string} */ invalidateUrl => {
console.log('invalidaaaating', currentCache._cacheObject);
currentCache.delete(invalidateUrl);
},
);