<commit_before>//
//  IAW_LocalStorageTool.swift
//  IAWExtensionTool
//  T对象实体 需要实现 NSObject,NSCoding 详细请参考 `IAW_Sample_T`
//  Created by IAskWind on 2017/9/11.
//  Copyright © 2017年 winston. All rights reserved.
//

import Foundation

open class IAW_LocalStorageTool<T>{
    //归档数组对象
    open class func setLSValues(key:String,values : [T])
    {
        NSKeyedArchiver.archiveRootObject(values, toFile: key.docDir())
    }
    
    //解档数组对象
    open class func getLSValues(key:String) -> [T]?
    {
        return NSKeyedUnarchiver.unarchiveObject(withFile: key.docDir()) as? [T]
    }
    //归档对象
    open class func setLSValue(key:String,value : T)
    {
        NSKeyedArchiver.archiveRootObject(value, toFile: key.docDir())
    }
    
    //解档对象
    open class func getLSValue(key:String) -> T?
    {
        return NSKeyedUnarchiver.unarchiveObject(withFile: key.docDir()) as? T
    }
    
    
    
}<commit_msg>添加根据key移除归档文件<commit_after>//
//  IAW_LocalStorageTool.swift
//  IAWExtensionTool
//  T对象实体 需要实现 NSObject,NSCoding 详细请参考 `IAW_Sample_T`
//  Created by IAskWind on 2017/9/11.
//  Copyright © 2017年 winston. All rights reserved.
//

import Foundation

open class IAW_LocalStorageTool<T>{
    //归档数组对象
    open class func setLSValues(key:String,values : [T])
    {
        NSKeyedArchiver.archiveRootObject(values, toFile: key.docDir())
    }
    
    //解档数组对象
    open class func getLSValues(key:String) -> [T]?
    {
        return NSKeyedUnarchiver.unarchiveObject(withFile: key.docDir()) as? [T]
    }
    //归档对象
    open class func setLSValue(key:String,value : T)
    {
        NSKeyedArchiver.archiveRootObject(value, toFile: key.docDir())
    }
    
    //解档对象
    open class func getLSValue(key:String) -> T?
    {
        return NSKeyedUnarchiver.unarchiveObject(withFile: key.docDir()) as? T
    }
    
    //清除归档文件
    open class func cleanLSByKey(key:String){
        let fileManager = FileManager.default
        try! fileManager.removeItem(atPath:  key.docDir())
        
    }

    
    
}
{'fraction_non_alphanumeric': 0.1142433234421365, 'fraction_numerical': 0.010880316518298714, 'mean_word_length': 2.6384892086330933, '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': '7489382', 'n_tokens_mistral': 775, 'n_tokens_neox': 768, 'n_words': 141}