Perform an atomic compare-and-set on the value in "key", using a prefix
        match on the provided value.
487938
def cas(self, key, value, new_value):
        
        return self.run_script('cas', keys=[key], args=[value, new_value])
564747
function(key, value) {
      if(!/(dimension|metric)[0-9]+/i.test(key)) {
        warn('custom: key must match dimension[0-9]+ or metric[0-9]+');
        return;
      }

      _set.call(this, 'set', key, value);

      return this;
    }
626188
function (key, value) {
        assertNotNull(key);

        var index = binarySearch(this.slot.keys, 0, this.slot.size, key, this.slot.comparer.compare);

        if (index >= 0) {
            error(ERROR_DUPLICATE_KEY);
        }

        this.insert(~index, key, value);
    }
208137
def check_key(self, key):
        """"""
        return _check_key(key, allow_unicode_keys=self.allow_unicode_keys,
                          key_prefix=self.key_prefix)
74551
def lpush(self, key, value, *values):
        
        return self.execute(b'LPUSH', key, value, *values)
499800
def _mappingGetValueSet(mapping, keys):
    
    setUnion = set()
    for k in keys:
        setUnion = setUnion.union(mapping[k])
    return setUnion
1111490
def is_set(self, key):
        
        path = key.split(self._key_delimiter)

        lower_case_key = key.lower()
        val = self._find(lower_case_key)

        if val is None:
            source = self._find(path[0].lower())
            if source is not None and isinstance(source, dict):
                val = self._search_dict(source, path[1::])

        return val is not None
790854
def make_compare(key, value, obj):
    ""
    if '__' not in key:
        # If no __ exists, default to doing an "exact" comparison
        key, comp = key, 'exact'
    else:
        key, comp = key.rsplit('__', 1)
    # Check if comp is valid
    if hasattr(Compare, comp):
        return getattr(Compare, comp)(key, value, obj)
    raise AttributeError("No comparison '%s'" % comp)
813757
private int findKey(K key) {
    int i = 0;
    for (K otherKey : this.keys) {
      if (this.comparator.compare(key, otherKey) == 0) {
        return i;
      }
      i++;
    }
    return -1;
  }
60952
public boolean isValueExistForKey(String key) {
		boolean isValueExists;
		try {
			String string = getString(key, "");
			isValueExists = !string.equalsIgnoreCase("");
		} catch (ClassCastException e) {
			try {
				int anInt = getInt(key, 0);
				isValueExists = anInt != 0;
			} catch (ClassCastException e1) {
				try {
					long aLong = getLong(key, 0);
					isValueExists = aLong != 0;
				} catch (ClassCastException e2) {
					try {
						float aFloat = getFloat(key, 0f);
						isValueExists = aFloat != 0;
					} catch (ClassCastException e3) {
						try {
							boolean aBoolean = getBoolean(key, false);
							isValueExists = !aBoolean;
						} catch (Exception e4) {
							isValueExists = false;
							e.printStackTrace();
						}
					}

				}

			}
		} catch (Exception e) {
			isValueExists = false;
		}
		return isValueExists;
	}
582133
def getset(self, key, value, *, encoding=_NOTSET):
        """"""
        return self.execute(b'GETSET', key, value, encoding=encoding)
785409
function set(key, value) {
  const entry = this.get(key, true);
  let oldvalue;
  if (entry) {
    oldvalue = entry.value;
    entry.value = value;
  } else {
    oldvalue = this.put(key, value);
    if (oldvalue) oldvalue = oldvalue.value;
  }
  return oldvalue;
}
716787
def getCachedOrUpdatedValue(self, key):
        
        try:
            return self._VALUES[key]
        except KeyError:
            return self.getValue(key)
730684
def _process_key_val(self, instance, key, val):
        '''
        
        '''
        if instance.check_precondition(key, val):
            combined = '{k}:{v}'.format(k=key, v=val)
            self._increment_total_stat(combined)
            self._increment_plugin_stat(
                instance.__class__.__name__,
                combined)
            instance.handle(key, val)
            self.redis_conn.delete(key)
            failkey = self._get_fail_key(key)
            if self.redis_conn.exists(failkey):
                self.redis_conn.delete(failkey)
1286103
function match(key, val) {
    // Handle logical operators
    if (key[0] == "$") {
      if (key=="$and" || key=="$or") {
        if (!util.isArray(val))  { throw key+" operator used without an array" };

        var i = val.map(function(q) { return Cursor.getIdsForQuery(db, q) });
        var fn = key=="$and" ? _.intersection : _.union; // Merging function

        if (i.indexOf(null)>-1) indexed = false;
        else push(fn.apply(_, i));
      }

      if (key=="$not") {
        var i = Cursor.getIdsForQuery(db, val);

        if (i === null) indexed = false;
        else exclude(i);
      }

      // TODO: emit error here on "else"
      return;
    };

    // The query is not fully indexed - set the flag and build the index
    if (! (db.indexes[key] && db.indexes[key].ready)) {
      indexed = false;
      if (db.options.autoIndexing) db.ensureIndex({ fieldName: key });
    };

    // 1) We can utilize this index and 2) we should
    var index = db.indexes[key];
    if (index && (indexed || !db.options.autoIndexing)) {
      if (val===undefined) return push(index.getAll()); // Useful when we invoke match() in sort loop
      if (document.isPrimitiveType(val)) return push(index.getMatching(val));
      if (typeof(val)=="object" && !_.keys(val).some(function(k) { return document.comparators[k] })) return push(index.getMatching(val));

      // Those can be combined
      if (val && val.hasOwnProperty("$ne")) exclude(index.getMatching(val.$ne));
      if (val && val.hasOwnProperty("$in")) push(index.getMatching(val.$in));
      if (val && val.hasOwnProperty("$nin")) exclude(index.getMatching(val.$nin));
      if (val && val.hasOwnProperty("$lt") || val.hasOwnProperty("$lte") || val.hasOwnProperty("$gt") || val.hasOwnProperty("$gte")) push(index.getBetweenBounds(val));
      if (val && val.hasOwnProperty("$exists") && val.$exists==true) push(index.getAll(function(n) { return n.key!==undefined }));
      if (val && val.hasOwnProperty("$exists") && val.$exists==false) push(index.getAll(function(n) { return n.key===undefined }));
      if (val && val.hasOwnProperty("$regex")) { var r = val.$regex; push(index.getAll(function(n) { return n.key && n.key.match(r) })); }
    };
  }
1120824
function comparison(model, options, keys, index=0) {
  const key = keys[index];

  if (keys.length === index) {
    return model[key] === options[key];
  } else if (model[key] === options[key]) {
    return comparison(model, options, keys, index + 1);
  }

  return false;
}
433485
@Override
    public boolean containsKey(Object key) {
        if (key == null) {
            throw new NullPointerException();
        }
        
        CachedValue<K, V> entry = map.get(key);
        if (entry == null) {
            return false;
        }
        if (isValueExpired(entry)) {
            if (map.remove(key, entry)) {
                onValueRemove(entry);
                return false;
            }
            return containsKey(key);
        }
        return true;
    }