<commit_before>//
//  MessagesSizingViewModel.swift
//  Rocket.Chat
//
//  Created by <NAME> on 25/09/18.
//  Copyright © 2018 Rocket.Chat. All rights reserved.
//

import Foundation

final class MessagesSizingManager {

    internal var cache: [AnyHashable: NSValue] = [:]
    internal var nibsCache: [AnyHashable: Any] = [:]

    /**
     Clear all height values cached.
     */
    func clearCache() {
        cache = [:]
    }

    func invalidateLayout(for identifier: AnyHashable) {
        cache.removeValue(forKey: identifier)
    }

    /**
     Returns the cached size for the IndexPath.
     */
    func size(for identifier: AnyHashable) -> CGSize? {
        return cache[identifier]?.cgSizeValue
    }

    /**
     Sets the cached size for the identified cell.
     */
    func set(size: CGSize, for identifier: AnyHashable) {
        return cache[identifier] = NSValue(cgSize: size)
    }

    /**
     Returns the cached view for identifier.
     */
    func view(for identifier: AnyHashable) -> Any? {
        return nibsCache[identifier]
    }

    /**
     Sets the cached view to specific identifier.
     */
    func set(view: Any, for identifier: AnyHashable) {
        return nibsCache[identifier] = view
    }

}
<commit_msg>Clear nibs cache on whole cache clearing<commit_after>//
//  MessagesSizingViewModel.swift
//  Rocket.Chat
//
//  Created by <NAME> on 25/09/18.
//  Copyright © 2018 Rocket.Chat. All rights reserved.
//

import Foundation

final class MessagesSizingManager {

    internal var cache: [AnyHashable: NSValue] = [:]
    internal var nibsCache: [AnyHashable: Any] = [:]

    /**
     Clear all height values cached.
     */
    func clearCache() {
        cache = [:]
        nibsCache = [:]
    }

    func invalidateLayout(for identifier: AnyHashable) {
        cache.removeValue(forKey: identifier)
    }

    /**
     Returns the cached size for the IndexPath.
     */
    func size(for identifier: AnyHashable) -> CGSize? {
        return cache[identifier]?.cgSizeValue
    }

    /**
     Sets the cached size for the identified cell.
     */
    func set(size: CGSize, for identifier: AnyHashable) {
        return cache[identifier] = NSValue(cgSize: size)
    }

    /**
     Returns the cached view for identifier.
     */
    func view(for identifier: AnyHashable) -> Any? {
        return nibsCache[identifier]
    }

    /**
     Sets the cached view to specific identifier.
     */
    func set(view: Any, for identifier: AnyHashable) {
        return nibsCache[identifier] = view
    }

}

{'fraction_non_alphanumeric': 0.1099332548095799, 'fraction_numerical': 0.007852375343541421, 'mean_word_length': 2.3263707571801566, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3518533', 'n_tokens_mistral': 799, 'n_tokens_neox': 744, 'n_words': 217}