/*
@visibility private
@param {Mixed} key - A JSON stringifiable value
@param {Mixed} val - a JSON stringifiable value
@param {Boolean} isSync - specifies which fs call to use
@param {Function} [fn] - A function called only if the value is async
973375
function(key, val, isSync, fn) {
    var filepath = this._makeFilepath(key);

        // Create cache key
    var cache = {
      ttl: new Date(Date.now() + this.ttl),
      data: val
    };

    var data = JSON.stringify(cache);
    var  method = isSync ? 'writeFileSync' : 'writeFile';
    var args = [filepath, data, 'UTF8', isSync ? null : fn];

    return fs[method].apply(fs, args);
  }
901311
static public Value put( Key key, Value val ) {
    Futures fs = new Futures();
    Value old = put(key,val,fs);
    fs.blockForPending();
    return old;
  }
187431
public V replace(K key, V val) {
       // synchronized( this ) {
            if( !containsKey(key) ) {
                return null;
            }
            return put(key, val);
        //}
    }
839071
function update( $key, $val = false ) {
			if ( ! is_array( $key ) ) {
				$key = array( $key => $val );
			}

			$is_updated = false;

			foreach ( $key as $k => $v ) {
				if ( $this->{$k} === $v ) {
					continue;
				}

				if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
				       ( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
				     $this->{$k} == $v
				) {
					continue;
				}

				// Update value.
				$this->{$k} = $v;

				$is_updated = true;
			}

			$this->_is_updated = $is_updated;

			return $is_updated;
		}
214503
function(key, callback) {
		if (typeof data[key] == 'undefined') {
			callback && callback(null, null)
		} else if (typeof data[key] == 'string' || typeof data[key] == 'number' || typeof data[key] == 'boolean') {
			callback && callback(null, data[key])
		} else {
			callback && callback(typeError('getBytes', 'string or number', key))
		}
	}
727627
static public Value put( Key key, Value val, Futures fs, boolean dontCache ) {
    assert key != null;
    assert val==null || val._key == key:"non-matching keys " + key + " != " + val._key;
    while( true ) {
      Value old = Value.STORE_get(key); // Raw-get: do not lazy-manifest if overwriting
      Value res = DputIfMatch(key,val,old,fs,dontCache);
      if( res == old ) return old; // PUT is globally visible now?
      if( val != null && val._key != key ) key = val._key;
    }
  }
801443
function(key, val, options={}){

    if(this.returnType === null){ return void 0; }
    var attrs = key;
    var value = this.value();

    // Noralize the data passed in
    if(this.returnType === 'model'){
      if (typeof key === 'object') {
        attrs = (key.isModel) ? key.attributes : key;
        options = val || {};
      } else {
        (attrs = {})[key] = val;
      }
    }
    if(this.returnType !== 'model'){ options = val || {}; }
    attrs = (attrs && attrs.isComputedProperty) ? attrs.value() : attrs;

    // If a new value, set it and trigger events
    this.setter && this.setter.call(this.__root__, attrs);

    if(this.returnType === 'value' && this.cache.value !== attrs) {
      this.cache.value = attrs;
      if(!options.quiet){
        // If set was called not through computedProperty.call(), this is a fresh new event burst.
        if(!this.isDirty && !this.isChanging) this.__parent__.changed = {};
        this.__parent__.changed[this.name] = attrs;
        this.trigger('change', this.__parent__);
        this.trigger('change:'+this.name, this.__parent__, attrs);
        delete this.__parent__.changed[this.name];
      }
    }
    else if(this.returnType !== 'value' && options.reset){ key = value.reset(attrs, options); }
    else if(this.returnType !== 'value'){ key = value.set(attrs, options); }
    this.isDirty = this.isChanging = false;

    // Call all reamining computed properties waiting for this value to resolve.
    _.each(this.waiting, function(prop){ prop && prop.call(); });

    return key;
  }
1362718
function (key, val) {
    if (lazy.typeOf(val) !== 'object') {
      lazy.set(this, key, val);
      return this;
    }
    this.addView(key, val);
    return this;
  }
482205
function(functionCache, hash, functionString, object) {
  // Contains the value we are going to set
  var value = null;

  // Check for cache hit, eval if missing and return cached function
  if(functionCache[hash] == null) {
    eval("value = " + functionString);
    functionCache[hash] = value;
  }
  // Set the object
  return functionCache[hash].bind(object);
}
628917
function (key, value) {
    /* jshint eqnull:true */
    _str.push(_encode(key) + '=' + (value === null || value === undefined ? '' : _encode(value)));
    // _str.push(( key ) + "=" +  (value == null ? "" : ( value )));
  }
1042195
@Override
    public CompletableFuture<Boolean> existsAsync(String key) {
        return (CompletableFuture) send("EXISTS", null, (Type) null, key, key.getBytes(UTF8));
    }
710158
static public Value put( Key key, Iced v, Futures fs,boolean dontCache ) {
    return put(key,new Value(key,v),fs,dontCache);
  }
593645
function isolate(fn, val) {
    var value, lastPromise;

    // Reset lastPromise for nested helpers
    Test.lastPromise = null;

    value = fn(val);

    lastPromise = Test.lastPromise;
    Test.lastPromise = null;

    // If the method returned a promise
    // return that promise. If not,
    // return the last async helper's promise
    if (value && value instanceof Test.Promise || !lastPromise) {
      return value;
    } else {
      return run(function () {
        return Test.resolve(lastPromise).then(function () {
          return value;
        });
      });
    }
  }
110374
@Override
	public void collect(final KEY key, final VALUE val) throws IOException {
		this.outTuple.f0 = key;
		this.outTuple.f1 = val;
		this.flinkCollector.collect(outTuple);
	}
851677
function(rel, key, val, callback) {
    if (typeof key == 'function') {
      callback = key;
      key = val = undefined;
    }

    if (Array.isArray(rel)) {
      var txn = this._safeBatch();
      var args = [key, val];
      async.map(rel, naan.ecurry(txn.rel.update, args, [1, 2]), callback);
      return this._safeBatchCommit(txn);
    }

    var id = this._getId(rel);

    if (!this._isValidId(id)) {
      return callback(new Error("Invalid ID"));
    }

    var endpoint = util.format('%s/properties', this._relRoot(id));
    if (key) endpoint += '/' + key;

    var op = this.operation(endpoint, 'PUT', key ? val : rel.properties);
    this.call(op, function(err) {
      callback(err);
    });
  }
1284538
public Eval<UploadResult> putAsync(String key, Object value) {
        return Eval.later(() -> put(key, value))
                   .map(t -> t.orElse(null))
                   .map(FluentFunctions.ofChecked(up -> up.waitForUploadResult()));

    }
303699
function(key, val, options) {
    var opts = options || {};
    var self = this;
    var attrs;
    /* eslint no-eq-null: 0*/
    if (key == null || typeof key === 'object') {
      opts = val || {};
      attrs = key;
    } else if (key) {
      (attrs = {})[key] = val;
    }
    // if saving only specified attributes, call set,
    // since preSave may depend on changed attributes
    if (attrs) {
      this.set(attrs, opts);
    }
    var error = opts.error;
    var fns = [
      _.bind(self.preSave, self, opts),
      _.bind(PromisedModel.prototype.save, self, key, opts),
      _.bind(self.afterSave, self, opts)
    ];
    return sequence(fns).then(function(results) {
      return results[1];
    }, function(err) {
      if (error) error.call(opts, self, err);
      return failWithError(opts, err);
    });
  }