Skip to content

Commit 8452970

Browse files
committed
fix: no possibility to set yasr to not use caching (fixes #169)
1 parent 7315d9e commit 8452970

5 files changed

Lines changed: 1879 additions & 1735 deletions

File tree

‎docs/developer-guide.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ This comprehensive guide covers everything developers need to know to integrate,
3636
- [Share Configuration](#share-configuration)
3737
- [YASR Configuration](#yasr-configuration)
3838
- [YASR Example](#yasr-example)
39+
- [Disabling Response Cache](#disabling-response-cache)
3940
- [Request Configuration](#request-configuration)
4041
- [Request Configuration Example](#request-configuration-example)
4142
- [Authentication](#authentication)
@@ -1347,6 +1348,36 @@ const yasr = new Yasr(document.getElementById('yasr'), {
13471348
});
13481349
```
13491350
1351+
#### Disabling Response Cache
1352+
1353+
To ensure YASR never shows a previously cached result, set:
1354+
1355+
- `maxPersistentResponseSize: 0`
1356+
1357+
Example:
1358+
1359+
```javascript
1360+
const yasr = new Yasr(document.getElementById("yasr"), {
1361+
persistenceId: "my-yasr",
1362+
maxPersistentResponseSize: 0,
1363+
});
1364+
```
1365+
1366+
Behavior details:
1367+
1368+
- `maxPersistentResponseSize <= 0` disables response persistence.
1369+
- On initialization, YASR does not restore a stored response.
1370+
- If a stored response exists for the same `persistenceId`, it is removed.
1371+
- New responses are not written to storage.
1372+
1373+
Important:
1374+
1375+
- `persistencyExpire: 0` does **not** mean "expire immediately". In current storage semantics, `0` acts as no expiry.
1376+
1377+
Regression coverage:
1378+
1379+
- Browser test: `test/run.ts` (`Yasr` suite, `does not restore previous response when response persistence is disabled`).
1380+
13501381
### Request Configuration
13511382
13521383
HTTP request configuration for SPARQL queries:

0 commit comments

Comments
 (0)