hscan

// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.hscan('key', 0, function (err, page) {
  // callback called once the action has completed
});

// Using promises (NodeJS only)
kuzzle.memoryStorage.hscanPromise('key', 0)
  .then(page => {
    // resolved once the action has completed
  });
kuzzle.memoryStorage.hscan("key", 0, new ResponseListener<JSONObject>() {
  @Override
  public void onSuccess(JSONObject page) {
  }

  @Override
  public void onError(JSONObject error) {
  }
});
<?php

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

try {
  $page = $kuzzle->memoryStorage()->hscan('key', 0);
}
catch (ErrorException $e) {

}

Callback response:

{
  "cursor": 18,
  "values": [
    "field1",
    "field1 value",
    "field2",
    "field2 value"
  ]
}

Identical to scan, except that hscan iterates the fields contained in a hash.

[Redis documentation]


hscan(key, cursor, [options], callback)

ArgumentsTypeDescription
keystringKey identifier
cursorintPage number (iteration starts with a cursor value of 0, and ends when the next cursor position is 0)
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
countintReturn the approximate count number of items per result page10
matchstringSearch only for field names matching the provided pattern*
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to an object containing 2 entries:

  • the cursor position for the next page of results (a next position of 0 indicates the end of the scan)
  • an array of, alternatively, field names and values