Skip to content

Commit

Permalink
#1807 rename for sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Nov 9, 2024
1 parent 4d07211 commit 1279e82
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions starsky/starsky.foundation.readmeta/Services/ReadMeta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void UpdateReadMetaCache(IEnumerable<FileIndexItem> objectExifToolModel)
{
foreach ( var item in objectExifToolModel )
{
UpdateReadMetaCache(item.FilePath!, item);
UpdateReadMetaCacheSingle(item.FilePath!, item);
}
}

Expand Down Expand Up @@ -153,6 +153,27 @@ public void UpdateReadMetaCache(IEnumerable<FileIndexItem> objectExifToolModel)
return true;
}


/// <summary>
/// Update Cache only for ReadMeta!
/// To 15 minutes
/// </summary>
/// <param name="fullFilePath">can also be a subPath</param>
/// <param name="objectExifToolModel">the item</param>
private void UpdateReadMetaCacheSingle(string fullFilePath, FileIndexItem objectExifToolModel)
{
if ( _cache == null || _appSettings?.AddMemoryCache == false )
{
return;
}

var toUpdateObject = objectExifToolModel.Clone();
var queryReadMetaCacheName = CachePrefix + fullFilePath;
RemoveReadMetaCache(fullFilePath);
_cache.Set(queryReadMetaCacheName, toUpdateObject,
new TimeSpan(0, 15, 0));
}

private async Task<FileIndexItem> ReadExifAndXmpFromFileDirectAsync(string subPath)
{
if ( _iStorage.ExistFile(subPath)
Expand Down Expand Up @@ -192,25 +213,4 @@ private async Task<FileIndexItem> ReadExifAndXmpFromFileDirectAsync(string subPa
FileIndexCompareHelper.Compare(fileExifItemFile, xmpFileIndexItem);
return fileExifItemFile;
}


/// <summary>
/// Update Cache only for ReadMeta!
/// To 15 minutes
/// </summary>
/// <param name="fullFilePath">can also be a subPath</param>
/// <param name="objectExifToolModel">the item</param>
public void UpdateReadMetaCache(string fullFilePath, FileIndexItem objectExifToolModel)
{
if ( _cache == null || _appSettings?.AddMemoryCache == false )
{
return;
}

var toUpdateObject = objectExifToolModel.Clone();
var queryReadMetaCacheName = CachePrefix + fullFilePath;
RemoveReadMetaCache(fullFilePath);
_cache.Set(queryReadMetaCacheName, toUpdateObject,
new TimeSpan(0, 15, 0));
}
}

0 comments on commit 1279e82

Please sign in to comment.