Skip to content

Commit

Permalink
Change: Use the globally defined variable NVTICACHE
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola committed Nov 23, 2022
1 parent 172a169 commit e8ba447
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rust/nvtcache/src/nvtcache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const NVTCACHE: &str = "nvticache";
const NVTICACHE: &str = "nvticache";
const PLUGIN_PATH: &str = "/home/jnicola/install/var/lib/openvas/plugins/";

use crate::dberror::Result;
Expand Down Expand Up @@ -35,13 +35,13 @@ impl NvtCache {

/// Set the key nvtcache
pub fn set_version(&mut self, feed_version: &str) -> Result<()> {
let _ = self.cache.redis_set_key("nvticache", feed_version)?;
let _ = self.cache.redis_set_key(NVTICACHE, feed_version)?;
Ok(())
}

/// Get the key nvtcache, which has the feed version
pub fn get_version(&mut self) -> Result<String> {
let version = self.cache.redis_get_key("nvticache")?;
let version = self.cache.redis_get_key(NVTICACHE)?;
Ok(version)
}

Expand All @@ -50,7 +50,7 @@ impl NvtCache {
/// with the version in the cache
/// Return True if it is updated, False if outdated, Error otherwise.
pub fn check_feed(&mut self, current: &str) -> Result<bool> {
let cached = self.cache.redis_get_key("nvticache")?;
let cached = self.cache.redis_get_key(NVTICACHE)?;
if cached == current {
return Ok(true);
}
Expand Down

0 comments on commit e8ba447

Please sign in to comment.