void moveItemAfterHit()

in ComponentTextKit/Utility/CKCacheImpl.h [472:497]


    void moveItemAfterHit(const KeyT &key)
    {
      auto it = _keysToCosts.find(key);
      if (it == _keysToCosts.end()) {
        return;
      }

      NSUInteger cost = it->second->second;
      if (cost > _preferredItemCostLimit) {
        // large items are put in the front of L2
        _costs.splice(_regularItemsQueueBegin, _costs, it->second);
        _regularItemsQueueBegin = it->second;
      } else {
        // small items are put in the front of L1
        auto itL1 = _keysToPreferredItemCosts.find(key);
        if (itL1 == _keysToPreferredItemCosts.end()) {
          _keysToPreferredItemCosts[key] = it->second;
          _preferredItemsCurrentCost += cost;
        }
        if (it->second == _regularItemsQueueBegin) {
          _regularItemsQueueBegin++;
        }
        _costs.splice(_costs.begin(), _costs, it->second);
      }
      _compactPreferredItemsQueueIfNeeded();
    }