diff --git a/docs/api-utility.md b/docs/api-utility.md index 7a07760d..b45ba6b0 100644 --- a/docs/api-utility.md +++ b/docs/api-utility.md @@ -9,14 +9,14 @@ ## cache -Gets, or when options are provided sets, the limits of _libvips'_ operation cache. +Gets or, when options are provided, sets the limits of _libvips'_ operation cache. Existing entries in the cache will be trimmed after any change in limits. This method always returns cache statistics, useful for determining how much working memory is required for a particular task. **Parameters** -- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching. +- `options` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching (optional, default `true`) - `options.memory` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum memory in MB to use for this cache (optional, default `50`) - `options.files` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum number of files to hold open (optional, default `20`) - `options.items` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** is the maximum number of operations to cache (optional, default `100`) @@ -37,7 +37,7 @@ Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer ## concurrency -Gets, or when a concurrency is provided sets, +Gets or, when a concurrency is provided, sets the number of threads _libvips'_ should create to process each image. The default value is the number of CPU cores. A value of `0` will reset to this default. diff --git a/lib/utility.js b/lib/utility.js index 67aaafa8..1cb26a61 100644 --- a/lib/utility.js +++ b/lib/utility.js @@ -4,7 +4,7 @@ const is = require('./is'); const sharp = require('../build/Release/sharp.node'); /** - * Gets, or when options are provided sets, the limits of _libvips'_ operation cache. + * Gets or, when options are provided, sets the limits of _libvips'_ operation cache. * Existing entries in the cache will be trimmed after any change in limits. * This method always returns cache statistics, * useful for determining how much working memory is required for a particular task. @@ -16,7 +16,7 @@ const sharp = require('../build/Release/sharp.node'); * sharp.cache( { files: 0 } ); * sharp.cache(false); * - * @param {Object|Boolean} options - Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching. + * @param {Object|Boolean} [options=true] - Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching * @param {Number} [options.memory=50] - is the maximum memory in MB to use for this cache * @param {Number} [options.files=20] - is the maximum number of files to hold open * @param {Number} [options.items=100] - is the maximum number of operations to cache @@ -39,7 +39,7 @@ function cache (options) { cache(true); /** - * Gets, or when a concurrency is provided sets, + * Gets or, when a concurrency is provided, sets * the number of threads _libvips'_ should create to process each image. * The default value is the number of CPU cores. * A value of `0` will reset to this default.