Skip to content

Commit 7c96c83

Browse files
committed
Update documentation on caching
1 parent dedaac5 commit 7c96c83

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ payloadDashboardAnalytics({
3131
siteId: PLAUSIBLE_SITE_ID,
3232
host: PLAUSIBLE_HOST, // optional, for self-hosted instances
3333
},
34+
cache: true,
3435
access: (user: any) => {
3536
return Boolean(user);
3637
},
@@ -94,6 +95,36 @@ payloadDashboardAnalytics({
9495
access: (user: any) => Boolean(user);
9596
```
9697

98+
- `cache` | optional
99+
100+
Accepts a boolean or a configuration object for cache management. **Defaults to false**.
101+
This creates a new collection type that will store cached data so that you don't get limited by the API.
102+
103+
```ts
104+
cache: true;
105+
```
106+
107+
- `slug` | optional
108+
109+
You can customise the slug of this new collection to avoid conflicts. Defaults to `analyticsData`.
110+
111+
- `routes` | optional
112+
113+
By default all routes are cached to one day. This is because for most analytics platforms the data report is about one day out anyway. Live data is cached to 5 minutes.
114+
115+
Object with any of these keys `globalAggregate` `globalChart` `pageAggregate` `pageChart` `report` `live` set to a number in minutes.
116+
117+
```ts
118+
routes?: {
119+
globalAggregate: 1440;
120+
globalChart: 1440;
121+
pageAggregate: 1440;
122+
pageChart: 1440;
123+
report: 1440;
124+
live: 5;
125+
};
126+
```
127+
97128
- `navigation` | optional
98129

99130
Object of either `beforeNavLinks` `afterNavLinks` which are arrays of [navigation widgets](#navigation).

0 commit comments

Comments
 (0)