# sscan

### 1. 基本語法

#### ssca&#x6E;**(`key`,  `cursor`, `['MATCH', pattern]`, `['COUNT', count]`,`callback`)**&#x20;

| Parameter | Default  |
| --------- | -------- |
| pattern   | '\*'     |
| count     | '10'     |

內容。

### **2. 範例**

**(1) 內容**

{% tabs %}
{% tab title="TypeScript" %}
```typescript
const arr = ['apple', 'potato', 'onion', 'tomato', 'melon']
client.sadd('food', arr);

let cursor = '0';
client.sscan('food', cursor, (err, scanner) => {
        cursor = scanner[0];
        let sub_set = scanner[1];
        console.log('Cursor: ', cursor);
        console.log('Members: ', sub_set);
    }
);
```
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output-TS" %}
```
Cursor:  0
Members:  [ 'tomato', 'apple', 'onion', 'potato', 'melon' ]
```
{% endtab %}
{% endtabs %}

**(2) 內容**

{% tabs %}
{% tab title="TypeScript" %}
```typescript
const arr = ['apple', 'potato', 'onion', 'tomato', 'melon']
client.sadd('food', arr);

let cursor = '0';
client.sscan('food', cursor, 'MATCH', '*a*', 'COUNT', '10', 
    (err, scanner) => {
        cursor = scanner[0];
        let sub_set = scanner[1];
        console.log('Cursor: ', cursor);
        console.log('Members: ', sub_set);
    }
);
```
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output-TS" %}
```
Cursor:  0
Members:  [ 'tomato', 'apple', 'potato' ]
```
{% endtab %}
{% endtabs %}
