Skip to content

Commit

Permalink
fix: reverse condition of insert if not exists (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
  • Loading branch information
MrCroxx committed Jul 24, 2023
1 parent 21e6ace commit 9669cf9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions foyer-storage/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ where

#[tracing::instrument(skip(self))]
pub async fn insert_if_not_exists(&self, key: K, value: V) -> Result<bool> {
if !self.exists(&key)? {
if self.exists(&key)? {
return Ok(false);
}
self.insert(key, value).await
Expand Down Expand Up @@ -309,7 +309,7 @@ where
where
F: FnOnce() -> anyhow::Result<V>,
{
if !self.exists(&key)? {
if self.exists(&key)? {
return Ok(false);
}
self.insert_with(key, f, weight).await
Expand All @@ -326,7 +326,7 @@ where
F: FnOnce() -> FU,
FU: FetchValueFuture<V>,
{
if !self.exists(&key)? {
if self.exists(&key)? {
return Ok(false);
}
self.insert_with_future(key, f, weight).await
Expand Down

0 comments on commit 9669cf9

Please sign in to comment.