public bool AddIfNotContains(FastDFSFileProviderConfiguration configuration)
        {
            if (_configurationDict.ContainsKey(configuration.ClusterName))
            {
                return(false);
            }

            lock (syncObject)
            {
                return(_configurationDict.TryAdd(configuration.ClusterName, configuration));
            }
        }
Пример #2
0
 protected virtual string BuildAccessUrl(FastDFSFileProviderConfiguration configuration, string containerName, string fileId)
 {
     if (configuration.AntiStealCheckToken)
     {
         return($"{configuration.HttpServer.EnsureEndsWith('/')}/{containerName}/{fileId}");
     }
     else
     {
         var timestamp = ToInt32(Clock.Now);
         var token     = Client.GetToken(fileId, timestamp, configuration.ClusterName);
         return($"{configuration.HttpServer.EnsureEndsWith('/')}/{containerName}/{fileId}?token={token}&ts={timestamp}");
     }
 }
Пример #3
0
 private string GetContainerName(FastDFSFileProviderConfiguration configuration, FileProviderArgs args)
 {
     return(configuration.GroupName.IsNullOrWhiteSpace()
         ? args.ContainerName
         : FileNormalizeNamingService.NormalizeContainerName(args.Configuration, configuration.GroupName));
 }
Пример #4
0
 private static string GetContainerName(FastDFSFileProviderConfiguration configuration, FileProviderArgs args)
 {
     return(configuration.GroupName.IsNullOrWhiteSpace()
         ? args.ContainerName
         : configuration.GroupName);
 }