{@inheritDoc} This value is cached and recomputed as needed when the
vector changes.
975612
@Override public double magnitude() {
        if (magnitude < 0) {
            magnitude = 0;
            TIntIterator iter = map.valueCollection().iterator();
            while (iter.hasNext()) {
                int i = iter.next();
                magnitude += i*i;
            }
            magnitude = Math.sqrt(magnitude);
        }
        return magnitude;
    }
815726
@Override
  protected void clearCache() {
    if (lastX != null) lastX[0] = Double.NaN;
    if (lastXBatch != null) lastXBatch[0] = Double.NaN;
    if (lastVBatch != null) lastVBatch[0] = Double.NaN;
  }
1366655
def cache(self, value):
        """"""
        value = bool(value)
        if self._cache and not value:
            self._clear()
        self._cache = value
554706
static public function setCache( $value )
	{
		$old = self::$cache;
		self::$cache = (boolean) $value;

		return $old;
	}
1090237
public void update(VectorTimestamp<T> timestamp) {
    VectorTimestamp<T> currentTimestamp = vector.get(timestamp.identifier());
    if (currentTimestamp == null || currentTimestamp.value() < timestamp.value()) {
      vector.put(timestamp.identifier(), timestamp);
    }
  }
1213596
@Override
  protected SoyValue visitVarRefNode(VarRefNode node) {

    // Cannot preevaluate injected data.
    if (node.isInjected()) {
      throw RenderException.create("Cannot preevaluate reference to ijData.");
    }

    // Otherwise, super method can handle it.
    SoyValue value = super.visitVarRefNode(node);

    if (value instanceof UndefinedData) {
      throw RenderException.create("Encountered undefined reference during preevaluation.");
    }

    return value;
  }
752858
@Override
  public void increment(double coord, double value) {
    // Store in cache
    if (cachefill >= 0) {
      if (cachefill < cachec.length) {
        cachec[cachefill] = coord;
        cachev[cachefill] = value;
        cachefill ++;
        return;
      } else {
        materialize();
        // But continue below!
      }
    }
    // Check if we need to resample to accomodate this bin.
    testResample(coord);
    // super class will handle histogram resizing / shifting
    super.increment(coord, value);
  }
448901
function mutablePropertyChange(inst, property, value, old, mutableData) {
  let isObject;
  if (mutableData) {
    isObject = (typeof value === 'object' && value !== null);
    // Pull `old` for Objects from temp cache, but treat `null` as a primitive
    if (isObject) {
      old = inst.__dataTemp[property];
    }
  }
  // Strict equality check, but return false for NaN===NaN
  let shouldChange = (old !== value && (old === old || value === value));
  // Objects are stored in temporary cache (cleared at end of
  // turn), which is used for dirty-checking
  if (isObject && shouldChange) {
    inst.__dataTemp[property] = value;
  }
  return shouldChange;
}
1087093
void copyValue(MutableBigInteger src) {
        int len = src.intLen;
        if (value.length < len)
            value = new int[len];
        System.arraycopy(src.value, src.offset, value, 0, len);
        intLen = len;
        offset = 0;
    }
1257192
@Override
    public void setValue(final Object value, final long time) throws DevFailed {
        this.setValue(value);
        this.setTime(time);
    }
880727
private void updateLocalCache(Object key, Object value) {
      localCache.compute(key, (k, v) -> {
         if (v instanceof Number && value instanceof Number) {
            return Math.max(((Number) v).longValue(), ((Number) value).longValue());
         } else {
            return value;
         }
      });
   }
575044
private void update(Collision collision,
                        double x,
                        double y,
                        int width,
                        int height,
                        Map<Collision, Rectangle> cacheRectRender)
    {
        if (boxs.containsKey(collision))
        {
            final Rectangle rectangle = boxs.get(collision);
            rectangle.set(x, y, width, height);
            cacheRectRender.get(collision).set(x, y, width, height);
        }
        else
        {
            final Rectangle rectangle = new Rectangle(x, y, width, height);
            cacheColls.add(collision);
            cacheRect.add(rectangle);
            cacheRectRender.put(collision, new Rectangle(x, y, width, height));
            boxs.put(collision, rectangle);
        }
    }
253690
@CacheEntryModified
   public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
   {
      if (!event.isPre() && event.getKey().equals(updateKey))
      {
         Object value = event.getValue();
         localUpdateInProgress = value != null ? (Boolean)value : false;

         for (IndexUpdateMonitorListener listener : listeners)
         {
            listener.onUpdateInProgressChange(localUpdateInProgress);
         }
      }
   }
1230857
private V retrieveCachedValue(boolean loadIfExpired, boolean updateStats) {

		V result;
		V oldValue = null;
		Throwable error = null;
		boolean missed = false;

		// race conditions are allowed
		this.approxAccessCounter++;

		long now;

		CachedValue<V> cached = cachedValue; // read the cached value

		if (cached != null) {

			long expiresAt = cached.expiresAt;
			if (expiresAt == Long.MAX_VALUE) {
				updateStats(false, false);
				return cached.value;
			}

			now = U.time();
			if (now <= expiresAt) {
				updateStats(false, false);
				return cached.value;
			}

		} else {
			now = U.time();
		}

		// ----------------- START LOCKS -----------------

		readLock();

		cached = cachedValue; // read the cached value again, inside the read lock

		if (cached == null || now > cached.expiresAt) {

			readUnlock();
			writeLock();

			// double-check: another thread might have acquired write lock and changed state already
			if (cached == null || now > cached.expiresAt) {

				V newValue;

				if (loadIfExpired) {
					try {
						newValue = loader != null ? loader.map(key) : null;

					} catch (Throwable e) {
						error = e;
						newValue = null;
					}

				} else {
					newValue = null;
				}

				oldValue = setValueInsideWriteLock(newValue);

				missed = true;
			}

			// downgrade by acquiring read lock before releasing write lock
			readLock();
			writeUnlock();
		}

		cached = cachedValue;
		result = cached != null ? cached.value : null; // read the cached value

		readUnlock();

		releaseOldValue(oldValue); // release the old value - outside of lock

		if (updateStats) {
			updateStats(missed, error != null);
		}

		if (error != null) {
			throw U.rte("Couldn't recalculate the cache value!", error);
		}

		return result;
	}
1232989
private void cacheEntryInserted(String key, T value)
    {
        InfinispanCacheEntryEvent<T> event =
            new InfinispanCacheEntryEvent<>(new InfinispanCacheEntry<T>(this, key, value));

        T previousValue = this.preEventData.get(key);

        if (previousValue != null) {
            if (previousValue != value) {
                disposeCacheValue(previousValue);
            }

            sendEntryModifiedEvent(event);
        } else {
            sendEntryAddedEvent(event);
        }
    }
55861
public void cacheDescriptorValue(IBond bond, IAtomContainer container, IDescriptorResult doubleResult) {
        if (cachedDescriptorValues == null) {
            cachedDescriptorValues = new HashMap();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) {
            cachedDescriptorValues.clear();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        }
        cachedDescriptorValues.put(bond, doubleResult);
    }
1064117
public function setValue($value): RedisCache
    {
        $redisclient = $this->getRedisConfig()->__invoke();
        $RedisData = (new RedisData())
            ->setData($value);
        $this->value = serialize($RedisData);
        $redisclient->setex($this->getKey(), $this->getExpire(), $this->getValue());

        return $this;
    }