update cache system

优化缓存系统的存储目录结构。
This commit is contained in:
hevinci
2023-03-01 20:35:01 +08:00
parent 295238cbb6
commit ab96f3f28c
5 changed files with 63 additions and 34 deletions
@@ -71,15 +71,16 @@ namespace YooAsset
if (string.IsNullOrEmpty(_cachedDataFilePath) == false)
return _cachedDataFilePath;
string folderName = FileHash.Substring(0, 2);
if (IsRawFile)
{
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}{_fileExtension}";
}
else
{
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
_cachedDataFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
_cachedDataFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleDataFileName}";
}
return _cachedDataFilePath;
}
@@ -96,15 +97,16 @@ namespace YooAsset
if (string.IsNullOrEmpty(_cachedInfoFilePath) == false)
return _cachedInfoFilePath;
string folderName = FileHash.Substring(0, 2);
if (IsRawFile)
{
string cacheRoot = PersistentHelper.GetCachedRawFileFolderPath(PackageName);
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
}
else
{
string cacheRoot = PersistentHelper.GetCachedBundleFileFolderPath(PackageName);
_cachedInfoFilePath = $"{cacheRoot}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
_cachedInfoFilePath = $"{cacheRoot}/{folderName}/{CacheGUID}/{YooAssetSettings.CacheBundleInfoFileName}";
}
return _cachedInfoFilePath;
}