For a CacheObject that had been previously released from the cache.
A new version is introduced, using the preallocated space for the object.
762102
public void restore(CachedObject object) {

        writeLock.lock();

        try {
            int i = object.getPos();

            cache.put(i, object);

            // was previously used for text tables
            if (storeOnInsert) {
                saveRow(object);
            }
        } finally {
            writeLock.unlock();
        }
    }
941855
K put(final K name) {
    K internal = cache.get(name);
    if (internal != null) {
      lookups++;
      return internal;
    }

    // Track the usage count only during initialization
    if (!initialized) {
      UseCount useCount = transientMap.get(name);
      if (useCount != null) {
        useCount.increment();
        if (useCount.get() >= useThreshold) {
          promote(name);
        }
        return useCount.value;
      }
      useCount = new UseCount(name);
      transientMap.put(name, useCount);
    }
    return null;
  }
468386
def cached(namespace=None, service="memory", debug=False):
    
    _service = getattr(debris.services, service)
    def wrapper(_f):
        @functools.wraps(_f)
        def _stash(self, *a, **k):
            if debug is False:
                # this request is cacheable
                try:
                    self.finish(_service.get(namespace))
                except LookupError:
                    _replace_finish(self, namespace, _service)
                    # get the result of this request
                    _f(self, *a, **k)
                return
            # request is not cacheable
            _f(self, *a, **k)
        return _stash
    return wrapper
548791
function CacheUpdate(bit, hash, state) {
  this.bit = bit;
  this.hash = hash;
  this.state = state;
}
784010
private void addHead(I_CmsLruCacheObject theCacheObject) {

        // set the list pointers correct
        if (m_objectCount > 0) {
            // there is at least 1 object already in the list
            I_CmsLruCacheObject oldHead = m_listHead;
            oldHead.setNextLruObject(theCacheObject);
            theCacheObject.setPreviousLruObject(oldHead);
            m_listHead = theCacheObject;
        } else {
            // it is the first object to be added to the list
            m_listTail = theCacheObject;
            m_listHead = theCacheObject;
            theCacheObject.setPreviousLruObject(null);
        }
        theCacheObject.setNextLruObject(null);

        // update cache stats. and notify the cached object
        increaseCache(theCacheObject);
    }
1097089
function releaseObject(object) {
    var cache = object.cache;
    if (cache) {
      releaseObject(cache);
    }
    object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
    if (objectPool.length < maxPoolSize) {
      objectPool.push(object);
    }
  }
635949
function (obj, cache) {
    if ( cache === void 0 ) cache = [];

    var t$ = Tool;
    // just return if obj is immutable value
    if (obj === null || typeof obj !== 'object') {
      return obj
    }

    // if obj is hit, it is in circular structure
    var hit = t$.find(cache, function (c) { return c.original === obj; });
    if (hit) {
      return hit.copy
    }

    var copy = Array.isArray(obj) ? [] : {};
    // put the copy into cache at first
    // because we want to refer it in recursive deepCopy
    cache.push({
      original: obj,
      copy: copy
    });

    Object.keys(obj).forEach(function (key) {
      copy[key] = t$.deepCopy(obj[key], cache);
    });

    return copy
  }
987853
function memoize(value, objectKey) {
            const oldValue = memoized[memoizedIndex];
            if (oldValue !== undefined) {
                memoizedMap.delete(oldValue);
                memoizedObjectMap.delete(oldValue);
            }
            
            if (objectKey)
                memoizedObjectMap.set(objectKey, memoizedIndex);
            else
                memoizedMap.set(value, memoizedIndex);
            memoized[memoizedIndex] = value;
            
            memoizedIndex++;
            if (memoizedIndex >= maxDictSize + MIN_DICT_INDEX)
                memoizedIndex = MIN_DICT_INDEX;
        }
485904
public VALUE put(KEY key, VALUE object) {
        CacheEntry<VALUE> entry;
        if (referenceType == ReferenceType.WEAK) {
            entry = new CacheEntry<>(new WeakReference<>(object), null);
        } else if (referenceType == ReferenceType.SOFT) {
            entry = new CacheEntry<>(new SoftReference<>(object), null);
        } else {
            entry = new CacheEntry<>(null, object);
        }

        countPutCountSinceEviction++;
        countPut++;
        if (isExpiring && nextCleanUpTimestamp == 0) {
            nextCleanUpTimestamp = System.currentTimeMillis() + expirationMillis + 1;
        }

        CacheEntry<VALUE> oldEntry;
        synchronized (this) {
            if (values.size() >= maxSize) {
                evictToTargetSize(maxSize - 1);
            }
            oldEntry = values.put(key, entry);
        }
        return getValueForRemoved(oldEntry);
    }
1370623
void reallocated(byte[] newContents, int newOffset) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "reallocated", new Object[]{newContents, Integer.valueOf(newOffset)});
    if (contents != null) {
      contents = newContents;
      offset = newOffset + 8;
      sharedContents = false;

      // Now we must run through the cache any pass the changes down to any depenedent
      // JSMessageData parts we find.
      // d282049: respect implicit state invariant implied by JSMessageData#unassemble
      // that an unassembled List can have no assembled contents
      if (cache != null) {
        for (int i = 0; i < cache.length; i++) {
          try {
            Object entry = cache[i];
            if (entry != null && entry instanceof JSMessageData) {
              ((JSMessageData)entry).reallocated(newContents, getAbsoluteOffset(i));
            }
          } catch (JMFUninitializedAccessException e) {
            // No FFDC code needed - this cannot occur as we know the JSMessageData part is present
          }
        }
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "reallocated");
  }
1190626
private void cacheLinkedObject(String owningObjID,
                                   String linkFieldName,
                                   DBObject linkedObject) {
        // Find or create map for the owning object.
        Map<String, Map<String, DBObject>> objMap = m_linkedObjectMap.get(owningObjID);
        if (objMap == null) {
            objMap = new HashMap<String, Map<String, DBObject>>();
            m_linkedObjectMap.put(owningObjID, objMap);
        }
        
        // Find or create map for the link field.
        Map<String, DBObject> linkMap = objMap.get(linkFieldName);
        if (linkMap == null) {
            linkMap = new HashMap<String, DBObject>();
            objMap.put(linkFieldName, linkMap);
        }
        
        // Add the object to the link map.
        linkMap.put(linkedObject.getObjectID(), linkedObject);
    }
392389
public Object createObjectCache(String cacheName) throws DynamicCacheServiceNotStarted, IllegalStateException {
    	if (objectCacheUnit == null) {
    		throw new DynamicCacheServiceNotStarted("Object cache service has not been started."); 
    	}
    	return objectCacheUnit.createObjectCache(cacheName);
    }
913295
@Override
  public synchronized void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer)
  {
    DoublesUnion union = unions.get(oldBuffer).get(oldPosition);
    final WritableMemory oldMem = getMemory(oldBuffer).writableRegion(oldPosition, maxIntermediateSize);
    if (union.isSameResource(oldMem)) { // union was not relocated on heap
      final WritableMemory newMem = getMemory(newBuffer).writableRegion(newPosition, maxIntermediateSize);
      union = DoublesUnion.wrap(newMem);
    }
    putUnion(newBuffer, newPosition, union);

    Int2ObjectMap<DoublesUnion> map = unions.get(oldBuffer);
    map.remove(oldPosition);
    if (map.isEmpty()) {
      unions.remove(oldBuffer);
      memCache.remove(oldBuffer);
    }
  }
213748
def cache(self):
        
        self.is_cached = True
        self.persist(StorageLevel.MEMORY_ONLY)
        return self
1065677
@Override
    public <T> T loadDataFromCache(Class<T> clazz, Object cacheKey, long maxTimeInCacheBeforeExpiry) throws CacheLoadingException, CacheCreationException {
        return getObjectPersister(clazz).loadDataFromCache(cacheKey, maxTimeInCacheBeforeExpiry);
    }
48636
def updatable_map(cache: MutableMapping[Domain, Range]) -> Operator[Map]:
    

    def wrapper(function: Map[Domain, Range]) -> Map[Domain, Range]:
        @wraps(function)
        def wrapped(argument: Domain) -> Range:
            try:
                return cache[argument]
            except KeyError:
                result = function(argument)
                cache[argument] = result
                return result

        return wrapped

    return wrapper
151658
boolean allocateTiny(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) {
        return allocate(cacheForTiny(area, normCapacity), buf, reqCapacity);
    }