diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Shares/IShareService.cs | 10 | ||||
| -rw-r--r-- | src/slskd/Shares/ShareService.cs | 14 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/slskd/Shares/IShareService.cs b/src/slskd/Shares/IShareService.cs index 962d4c1e..7ee39313 100644 --- a/src/slskd/Shares/IShareService.cs +++ b/src/slskd/Shares/IShareService.cs @@ -45,6 +45,16 @@ namespace slskd.Shares Task<IEnumerable<Directory>> BrowseAsync(); /// <summary> + /// (Re)Creates the cache. + /// </summary> + /// <remarks> + /// This should generally only be called if <see cref="TryLoadFromDiskAsync"/> has returned false. + /// </remarks> + /// <param name="discardExisting">A value indicating whether an existing cache should be discarded prior to creation.</param> + /// <returns>The operation context.</returns> + Task CreateAsync(bool discardExisting = false); + + /// <summary> /// Returns the contents of the specified <paramref name="directory"/>. /// </summary> /// <param name="directory">The directory for which the contents are to be listed.</param> diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index 96ac4c1c..d40be652 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -99,6 +99,20 @@ namespace slskd.Shares } /// <summary> + /// (Re)Creates the cache. + /// </summary> + /// <remarks> + /// This should generally only be called if <see cref="TryLoadFromDiskAsync"/> has returned false. + /// </remarks> + /// <param name="discardExisting">A value indicating whether an existing cache should be discarded prior to creation.</param> + /// <returns>The operation context.</returns> + public Task CreateAsync(bool discardExisting = false) + { + Cache.Create(discardExisting); + return Task.CompletedTask; + } + + /// <summary> /// Returns the contents of the specified <paramref name="directory"/>. /// </summary> /// <param name="directory">The directory for which the contents are to be listed.</param> |
