Comparing version 1.4.4 to 1.4.5
# Changelog | ||
## [1.4.5](https://github.com/alexzel/iomem/compare/v1.4.4...v1.4.5) (2023-01-30) | ||
### Bug Fixes | ||
* fix quit command test failing time to time ([1d82063](https://github.com/alexzel/iomem/commit/1d82063ef8a73d8e768a9a7593d578f60f3c8d2f)) | ||
* fix readme and client options comments ([42267ea](https://github.com/alexzel/iomem/commit/42267eaa6d38c8894098b278161e1172693ee24f)) | ||
## [1.4.4](https://github.com/alexzel/iomem/compare/v1.4.3...v1.4.4) (2023-01-30) | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "iomem", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "Memcached client implementing binary protocol with native multiple keys support", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -35,3 +35,3 @@ # `iomem` | ||
The constructor accepts two optional arguments - servers list and options object. | ||
The constructor accepts two optional arguments - servers list and config options. | ||
@@ -46,3 +46,3 @@ ```js | ||
### Default | ||
### Basic usage | ||
@@ -103,4 +103,3 @@ ```js | ||
failoverServers: [], // failover servers list | ||
keepAliveInitialDelay: 0 // initial delay in milliseconds for keep-alive on sockets, zero means | ||
// the sockets keep-alive functionality is disabled | ||
keepAliveInitialDelay: 0 // initial delay in milliseconds for keep-alive functionality | ||
} | ||
@@ -142,7 +141,7 @@ ``` | ||
The following data types for `key` and `expiry` are must by ensured by the library user: | ||
The following data types for `key` and `expiry` must be ensured by the library user: | ||
`key: string` - storage key, 250 bytes max as defined in [Memcached](https://github.com/memcached/memcached/blob/master/memcached.h#L68) | ||
`expiry: unsigned integer` - time interval in seconds, defaults to `expiry` from the client config. | ||
`expiry: unsigned integer` - time interval in **seconds**, defaults to `expiry` from the config [options](#options). | ||
@@ -165,3 +164,3 @@ For more details please [Memcached commands](https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#commands). | ||
`getsv(key): {value, cas}|null` - get cas for a single key. | ||
`getsv(key): {value, cas}|null` - get cas and value for a single key. | ||
@@ -172,3 +171,3 @@ `getsv([key1, ...]): {key: {value, cas}}, ...}` - get a `key => { value, cas }` object for multiple keys. | ||
Set methods return `true` when all values were successfully set. Otherwise, when client receives `0x0001` or `0x0002` [statuses ](https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#response-status) from Memcached (this is abnormal behavior for set commands), the returned value will be `false`. | ||
Set methods return `true` when all values were successfully set. Otherwise, when client receives `0x0001` or `0x0002` [statuses](https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#response-status) from Memcached (this is abnormal behavior for set commands), the returned value will be `false`. | ||
@@ -203,3 +202,3 @@ `set(key, value, expiry): true|false` - set a value for a single key. | ||
The `cas` command sets a key with a new value only when `cas` parameter matches `cas` value stored in the key. To retrieve the current `cas` value for a key please see [GET](#get) commands. | ||
The `cas` command sets a key with a new value only when `cas` parameter matches `cas` value stored in a key. To retrieve the current `cas` value for a key please see [GET](#get) commands. | ||
@@ -221,5 +220,5 @@ `cas(key, value, cas, expiry): true|false` - set a value if the cas matches. | ||
`incr(key, initial, delta, expiry): value` - increments counter and returns its value. | ||
`incr(key, initial, delta, expiry): value` - increment counter and returns its value. | ||
`decr(key, initial, delta, expiry): value` - decrements coutner and returns its value. | ||
`decr(key, initial, delta, expiry): value` - decrement coutner and returns its value. | ||
@@ -257,7 +256,7 @@ Paramters: | ||
`version(): {<hostname>: <version>, ...}` - get Memcached version string by a server hostname. | ||
`version(): {<hostname>: <version>, ...}` - get Memcached version string from all servers and return `hostname => version` object. | ||
### APPEND AND PREPEND | ||
Append and prepend commands either append or prepend a string value to the existing value stored by a key. | ||
Append and prepend commands either append or prepend a string value to an existing value stored by a key. | ||
@@ -296,7 +295,7 @@ #### Append methods | ||
Stat command requests statistics from each server. Without a key the stat command will return a default set of statistics information by a server hostname' | ||
Stat command requests statistics from each server. Without a key the stat command will return a default set of statistics information for each server. | ||
`stat(): {<hostname>: object, ...}` - get a default set of statistics information by a server hostname. | ||
`stat(): {<hostname>: object, ...}` - get a default set of statistics information in `hostname => object` format. | ||
`stat(key): {<hostname>: object, ...}` - get statistics specified with a key (e.g. 'items', 'slabs', 'sizes') by a server hostname, see [Memcached wiki](https://github.com/memcached/memcached/wiki/Commands#statistics). | ||
`stat(key): {<hostname>: object, ...}` - get statistics specified with a key (e.g. `items`, `slabs`, `sizes`) in `hostname => object` format, see [Memcached wiki](https://github.com/memcached/memcached/wiki/Commands#statistics). | ||
@@ -315,7 +314,7 @@ | ||
Gat command sets a new expiration time for a key and returns the key value. | ||
Gat command sets a new expiration time for a key and returns a key value. | ||
`gat(key, expiry): null|value` - set expiration time for a single key. | ||
`gat([key1, ...], expiry): [value, ...]` - set expiration time for a single key. | ||
`gat([key1, ...], expiry): [value, ...]` - set expiration time for a multiple keys. | ||
@@ -329,2 +328,4 @@ | ||
Please see [Case #2](#case-2) for a better approach. | ||
```js | ||
@@ -428,3 +429,3 @@ const Mem = require('iomem') | ||
But in reality it won't know anything about your client instances and therefore their configs as it's a | ||
static class method. So it will fall to using the default 1 day interval as an expiry. | ||
static class method. So by default it will 1 day interval as an expiry. | ||
@@ -431,0 +432,0 @@ In order to supply static methods with default expiry, please use `Mem.setDefaultExpiry(expiry)` static method. |
@@ -18,3 +18,3 @@ 'use strict' | ||
failoverServers: [], // failover servers list | ||
keepAliveInitialDelay: 0 // initial delay in milliseconds for keep-alive on sockets, zero means the sockets keep-alive is disabled | ||
keepAliveInitialDelay: 0 // initial delay in milliseconds for keep-alive functionality, zero means the sockets keep-alive is disabled | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -503,9 +503,8 @@ 'use strict' | ||
// open two sockets | ||
// open 1 socket | ||
await iomem.set('test:foo', 'bar') | ||
expect(await iomem.get('test:foo')).toBe('bar') | ||
// expect 2 sockets to be opened | ||
// expect 1 socket to be opened | ||
const openSockets = getOpenSockets() | ||
expect(openSockets).toBe(2) | ||
expect(openSockets).toBe(1) | ||
@@ -515,4 +514,4 @@ // quit opens a new socket and closes it immediately | ||
// so we don't spawn a new connection and still have 2 sockets open | ||
expect(getOpenSockets()).toBe(2) | ||
// so we don't spawn a new connection and still have 1 socket open | ||
expect(getOpenSockets()).toBe(1) | ||
}) | ||
@@ -519,0 +518,0 @@ }) |
100202
453
2042