You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/content/docs/cache_drivers.md
+10-3
Original file line number
Diff line number
Diff line change
@@ -65,8 +65,10 @@ import { fileDriver } from "bentocache/drivers/file";
65
65
const bento =newBentoCache({
66
66
default: 'file',
67
67
stores: {
68
-
redis: bentostore().useL2Layer(fileDriver({
69
-
directory: './cache'
68
+
redis: bentostore().useL2Layer(
69
+
fileDriver({
70
+
directory: './cache',
71
+
pruneInterval: '1h'
70
72
}))
71
73
}
72
74
})
@@ -75,6 +77,11 @@ const bento = new BentoCache({
75
77
| Option | Description | Default |
76
78
| --- | --- | --- |
77
79
|`directory`| The directory where the cache files will be stored. | N/A |
80
+
|`pruneInterval`| The interval in milliseconds to prune expired entries. false to disable. | false |
81
+
82
+
### Prune Interval
83
+
84
+
Since the filesystem driver does not have a way to automatically prune expired entries, you can set a `pruneInterval` to automatically prune expired entries. By setting this option, the driver will launch a [worker thread](https://nodejs.org/api/worker_threads.html) that will clean up the cache at the specified interval.
78
85
79
86
## Memory
80
87
@@ -165,7 +172,7 @@ All SQL drivers accept the following options:
165
172
|`tableName`| The name of the table that will be used to store the cache. |`bentocache`|
166
173
|`autoCreateTable`| If the cache table should be automatically created if it does not exist. |`true`|
167
174
|`connection`| An instance of `knex` or `Kysely` based on the driver. | N/A |
168
-
|`pruneInterval`| The interval in milliseconds to prune expired entries. |`60000`|
175
+
|`pruneInterval`| The [Duration](./options.md#ttl-formats) in milliseconds to prune expired entries. |false|
0 commit comments