From f61ee9c602ba26688db090b0458ab49b768d5170 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 21 Sep 2022 20:35:15 -0500 Subject: add CreateAsync --- src/slskd/Shares/IShareService.cs | 10 ++++++++++ src/slskd/Shares/ShareService.cs | 14 ++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'src') 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 @@ -44,6 +44,16 @@ namespace slskd.Shares /// The entire contents of the share. Task> BrowseAsync(); + /// + /// (Re)Creates the cache. + /// + /// + /// This should generally only be called if has returned false. + /// + /// A value indicating whether an existing cache should be discarded prior to creation. + /// The operation context. + Task CreateAsync(bool discardExisting = false); + /// /// Returns the contents of the specified . /// 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 @@ -98,6 +98,20 @@ namespace slskd.Shares return Task.FromResult(normalizedResults); } + /// + /// (Re)Creates the cache. + /// + /// + /// This should generally only be called if has returned false. + /// + /// A value indicating whether an existing cache should be discarded prior to creation. + /// The operation context. + public Task CreateAsync(bool discardExisting = false) + { + Cache.Create(discardExisting); + return Task.CompletedTask; + } + /// /// Returns the contents of the specified . /// -- cgit v1.2.3