Skip to content

Commit

Permalink
Merge pull request #786 from rustaceanrob/remove-webhook
Browse files Browse the repository at this point in the history
cache: remove webhook
  • Loading branch information
ok300 authored Feb 11, 2024
2 parents d69fcc0 + 9d09098 commit fe8f256
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/sdk-core/src/persist/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl SqliteStorage {
}

#[allow(dead_code)]
pub fn delete_cached_item(&self, key: String) -> PersistResult<()> {
pub fn delete_cached_item(&self, key: &str) -> PersistResult<()> {
self.get_connection()?
.execute("DELETE FROM cached_items WHERE key = ?1", [key])?;
Ok(())
Expand Down Expand Up @@ -99,6 +99,11 @@ impl SqliteStorage {
self.update_cached_item(KEY_WEBHOOK_URL, webhook_url)
}

#[allow(dead_code)]
pub fn remove_webhook_url(&self) -> PersistResult<()> {
self.delete_cached_item(KEY_WEBHOOK_URL)
}

#[allow(dead_code)]
pub fn get_webhook_url(&self) -> PersistResult<Option<String>> {
self.get_cached_item(KEY_WEBHOOK_URL)
Expand All @@ -118,7 +123,7 @@ fn test_cached_items() {
let item_value = storage.get_cached_item("key1").unwrap();
assert_eq!(item_value, Some("val1".to_string()));

storage.delete_cached_item("key1".to_string()).unwrap();
storage.delete_cached_item("key1").unwrap();
let item_value = storage.get_cached_item("key1").unwrap();
assert_eq!(item_value, None);
}

0 comments on commit fe8f256

Please sign in to comment.