Esempio n. 1
0
 /**
  * set a value at a given index on a certain key
  *
  * {{{
  *   Lists::set('foo', 3, 'bar'); // sets third value of `foo` to `bar`
  *   Lists::set('foo', array(3 => 'bar')); // same as above
  *   Lists::set('foo', array(3 => 'bar', 2 => 'baz')); // set multiple values at once
  * }}}
  *
  * @see li3_redis\storage\Redis::listSet()
  * @see li3_redis\storage\Redis::getKey()
  * @param string $key redis key in which to store the hash
  * @param integer|array $index index to replace or an array with index and their value
  * @param mixed $value value to be set on given index
  * @param array $options array with additional options, see Redis::getKey()
  * @filter
  */
 public static function set($key, $index, $value = null, array $options = array())
 {
     $defaults = array('namespace' => static::$namespace);
     $options += $defaults;
     $params = compact('key', 'index', 'value', 'options');
     return static::_filter(__METHOD__, $params, function ($self, $params) {
         return Redis::listSet($params['key'], $params['index'], $params['value'], $params['options']);
     });
 }