@@ -108,20 +108,58 @@ passing an array of `$options` in the constructor:
108108 ** Type** : ` int `
109109 ** Default** : ` 500 `
110110
111- * ** cache_tags_header** : The HTTP header name used to check for tags
111+ * ** cache_tags_header** : The HTTP header name that's used to check for tags.
112112
113113 ** Type** : ` string `
114114 ** Default** : ` Cache-Tags `
115+
116+ * ** generate_content_digests** : Whether or not content digests should be generated.
117+ See "Generating Content Digests" for more information.
118+
119+ ** Type** : ` boolean `
120+ ** Default** : ` true `
121+
122+ ### Generating Content Digests
123+
124+ By default, this cache implementation generates content digests.
125+ This means that the response meta data is stored separately from the
126+ response content. If multiple responses share the same content, it
127+ is stored in the cache only once.
128+ Compare the following illustrations to see the difference:
129+
130+ ** With generating content digests** :
131+
132+ ![ Illustration of the cache with generating content digests] ( docs/with_content_digests.svg )
133+
134+ ** Without generating content digests** :
135+
136+ ![ Illustration of the cache without generating content digests] ( docs/without_content_digests.svg )
137+
138+ Generating content digests optimizes the cache so it uses up less
139+ storage. Using them, however, also comes at the costs of requiring
140+ a second round trip to fetch the content digest from the cache during
141+ the lookup process.
142+
143+ Whether or not you want to use content digests depends on your PSR-6
144+ cache back end. If lookups are fast and storage is rather limited (e.g. Redis),
145+ you might want to use content digests. If lookups are rather slow and
146+ storage is less of an issue (e.g. Filesystem), you might want to disable
147+ them.
148+
149+ You can control the behaviour using the ` generate_content_digests ` configuration
150+ option.
115151
116- ### Caching ` BinaryFileResponse ` instances
152+ ### Caching ` BinaryFileResponse ` Instances
117153
118- This cache implementation allows to cache ` BinaryFileResponse ` instances but the files are not actually copied to
119- the cache directory. It will just try to fetch the original file and if that does not exist anymore, the store returns
154+ This cache implementation allows to cache ` BinaryFileResponse ` instances but
155+ the files are not actually copied to the cache directory. It will just try to
156+ fetch the original file and if that does not exist anymore, the store returns
120157` null ` , causing HttpCache to deal with it as a cache miss and continue normally.
121- It is ideal for use cases such as caching ` /favicon.ico ` requests where you would like to prevent the application from
122- being started and thus deliver the response from HttpCache.
158+ It is ideal for use cases such as caching ` /favicon.ico ` requests where you would
159+ like to prevent the application from being started and thus deliver the response
160+ from HttpCache.
123161
124- ### Cache tagging
162+ ### Cache Tagging
125163
126164Tag cache entries by adding a response header with the tags as a comma
127165separated value. By default, that header is called ` Cache-Tags ` , this can be
@@ -131,7 +169,7 @@ To invalidate tags, call the method `Psr6Store::invalidateTags` or use the
131169` PurgeTagsListener ` from the [ FOSHttpCache] [ 3 ] library to handle tag
132170invalidation requests.
133171
134- ### Pruning expired cache entries
172+ ### Pruning Expired Cache Items
135173
136174By default, this store removes expired entries from the cache after every ` 500 `
137175cache ** write** operations. Fetching data does not affect performance.
0 commit comments