// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.hset('key', 'field', 'value', function (err, status) {
  // callback called once the action has completed

// Using promises (NodeJS only)
kuzzle.memoryStorage.hsetPromise('key', 'field', 'value')
  .then(status => {
    // resolved once the action has completed
kuzzle.memoryStorage.hset("key", "field", "value", new ResponseListener<Integer>() {
  public void onSuccess(Integer status) {
    // callback called once the action has completed

  public void onError(JSONObject error) {

use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');

try {
  $status = $kuzzle->memoryStorage()->hset('key', 'field', 'value');
catch (ErrorException $e) {


Callback response:


Sets a field and its value in a hash. If the key does not exist, a new key holding a hash is created. If the field already exists, its value is overwritten.

[Redis documentation]

hset(key, field, value, [options], [callback])

keystringKey identifier
fieldstringField name to insert or to update
valuestringAssociated field value
optionsJSON ObjectOptional parameters


queuablebooleanMark this request as (not) queuabletrue

Return value

Returns the MemoryStorage object to allow chaining.

Callback response

Resolves to an integer indicating if the insertion succeeded (1) or failed (0).