mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose control of the number of open files in libvips' cache.
Breaks API of existing cache method. Disable libvips cache for I/O tests.
This commit is contained in:
21
docs/api.md
21
docs/api.md
@@ -590,19 +590,26 @@ An Object containing the version numbers of libvips and, on Linux, its dependenc
|
||||
|
||||
### Utilities
|
||||
|
||||
#### sharp.cache([memory], [items])
|
||||
#### sharp.cache([options])
|
||||
|
||||
If `memory` or `items` are provided, set the limits of _libvips'_ operation cache.
|
||||
If `options` is provided, sets the limits of _libvips'_ operation cache.
|
||||
|
||||
* `memory` is the maximum memory in MB to use for this cache, with a default value of 100
|
||||
* `items` is the maximum number of operations to cache, with a default value of 500
|
||||
* `options.memory` is the maximum memory in MB to use for this cache, with a default value of 50
|
||||
* `options.files` is the maximum number of files to hold open, with a default value of 20
|
||||
* `options.items` is the maximum number of operations to cache, with a default value of 100
|
||||
|
||||
`options` can also be a boolean, where `true` enables the default cache settings and `false` disables all caching.
|
||||
|
||||
This method always returns cache statistics, useful for determining how much working memory is required for a particular task.
|
||||
|
||||
```javascript
|
||||
var stats = sharp.cache(); // { current: 75, high: 99, memory: 100, items: 500 }
|
||||
sharp.cache(200); // { current: 75, high: 99, memory: 200, items: 500 }
|
||||
sharp.cache(50, 200); // { current: 49, high: 99, memory: 50, items: 200}
|
||||
var stats = sharp.cache();
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp.cache( { items: 200 } );
|
||||
sharp.cache( { files: 0 } );
|
||||
sharp.cache(false);
|
||||
```
|
||||
|
||||
#### sharp.concurrency([threads])
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
### v0.13 - "*mind*"
|
||||
|
||||
* Control number of open files in libvips' cache; breaks existing `cache` behaviour.
|
||||
[#315](https://github.com/lovell/sharp/issues/315)
|
||||
|
||||
### v0.12 - "*look*"
|
||||
|
||||
#### v0.12.2 - 16<sup>th</sup> January 2016
|
||||
|
||||
Reference in New Issue
Block a user