gpt4 book ai didi

c# - JavaScriptCompressor、CssCompressor 和多线程

转载 作者:太空宇宙 更新时间:2023-11-03 16:04:54 24 4
gpt4 key购买 nike

我正在使用静态类来包装 Yahoo YUI compressor :

public static class Minifier
{
private static readonly ICompressor javaScriptCompressor =
new JavaScriptCompressor()
{
CompressionType = CompressionType.Standard,
IgnoreEval = true,
ObfuscateJavascript = true,
PreserveAllSemicolons = true
};

private static readonly ICompressor cssCompressor = new CssCompressor()
{
CompressionType = CompressionType.Standard,
RemoveComments = true
};

public static string GetCompressedCss(string data)
{
//aaaand... action
return cssCompressor.Compress(data);
}
}

我想知道压缩器类是否是线程保存的?

最佳答案

JavaScriptCompressor 不是线程安全的,应该在使用时重新创建(它存储状态)。 CssCompressor 不存储状态。

关于c# - JavaScriptCompressor、CssCompressor 和多线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19854698/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com