From ca70f7e3c1076ab85300c3c151dce8eabbc7e6b0 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Thu, 28 Sep 2017 21:28:04 +0200 Subject: [PATCH 1/2] document pruning and the prune method in readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 3984034..d1ab2fd 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,18 @@ To invalidate tags, call the method `Psr6Store::invalidateTags` or use the `PurgeTagsListener` from the [FOSHttpCache][3] library to handle tag invalidation requests. +### Pruning Expired Cache Entries + +By default, this cache removes expired entries from the cache after every 500 +cache write operations. You can change the frequency with the `prune_threshold` +configuration setting. + +You can also manually trigger pruning by calling the `prune()` method on the +cache. With this, you could for example implement a cronjob that loads the store +and prunes it at a configured interval, to prevent slowing down random requests +that were cache misses because they have to wait for the pruning to happen. If you +have set up a cron job, you should disable pruning by setting the threshold to 0. + ### WARNING It is possible to configure other cache adapters or lock stores than the From cc3b158b59162c1f54c5e8daa0dbfb5b30a8e6f3 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Fri, 29 Sep 2017 07:59:14 +0200 Subject: [PATCH 2/2] Minor wording improvements --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d1ab2fd..06cc3c5 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ passing an array of `$options` in the constructor: **Type**: `string` **Default**: `Cache-Tags` -### Cache Tagging +### Cache tagging Tag cache entries by adding a response header with the tags as a comma separated value. By default, that header is called `Cache-Tags`, this can be @@ -103,17 +103,19 @@ To invalidate tags, call the method `Psr6Store::invalidateTags` or use the `PurgeTagsListener` from the [FOSHttpCache][3] library to handle tag invalidation requests. -### Pruning Expired Cache Entries +### Pruning expired cache entries -By default, this cache removes expired entries from the cache after every 500 -cache write operations. You can change the frequency with the `prune_threshold` +By default, this store removes expired entries from the cache after every `500` +cache **write** operations. Fetching data does not affect performance. +You can change the automated pruning frequency with the `prune_threshold` configuration setting. You can also manually trigger pruning by calling the `prune()` method on the -cache. With this, you could for example implement a cronjob that loads the store +cache. With this, you could for example implement a cron job that loads the store and prunes it at a configured interval, to prevent slowing down random requests that were cache misses because they have to wait for the pruning to happen. If you -have set up a cron job, you should disable pruning by setting the threshold to 0. +have set up a cron job, you should disable auto pruning by setting the threshold +to `0`. ### WARNING