public synchronized void touch(ShareSession session, long now) {
        synchronized (session) {
            // Update the lastUsed map.
            lastUsed.remove(session.lastUsedKey());
            session.lastUsedMs(now);
            lastUsed.put(session.lastUsedKey(), session);

            int oldSize = session.cachedSize();
            if (oldSize != -1) {
                numPartitions = numPartitions - oldSize;
            }
            session.cachedSize(session.size());
            numPartitions = numPartitions + session.cachedSize();
        }
    }
Update a session's position in the lastUsed tree.

@param session  The session.
@param now      The current time in milliseconds.
server/src/main/java/org/apache/kafka/server/share/ShareSessionCache.java