Private static string GetFileUrl (string folder, string fileName)
{
String key=$" AppendVersion. {folder}. {fileName} ";
A string value.
if (! _cache. TryGetValue (key, value) out)
{
Value="https://bbs.csdn.net/topics/$/{folder}/{fileName}";
Var options=new MemoryCacheEntryOptions (). AddExpirationToken (_env. WebRootFileProvider. Watch (value));
Var the fileInfo=_env. WebRootFileProvider. GetFileInfo (value);
If (the fileInfo. The Exists)
{
Value +=the fileInfo. LastModified. ToLocalTime (), ToString ("? YyMMddHHmmss ");
}
_cache. Set (key, value, the options).
}
return value;
}
CodePudding user response:
Static methods referenced in the statement as static variables, obviously, the more some people around the pattern, the more abstract the tall,Programming should be "only to do the necessary", don't too early to use redundant mode, the idea in different people have different understanding, but I am always stressed "do not make unnecessary abstraction, must avoid crosscutting and inversion of empty practices" ,
CodePudding user response:
Crosscutting, inversion, such as words, actually know as soon as you see, this is to emphasize life without of variables, and dynamically modify the code,What do you think of everything as abstract don't need to fall to the ground, this way is really conducive to debug (especially a large number of high-strength stack code debugging), maintenance, expansion?
CodePudding user response: