diff --git a/hwe/sammo/KVStorage.php b/hwe/sammo/KVStorage.php index 518e01de..8902916b 100644 --- a/hwe/sammo/KVStorage.php +++ b/hwe/sammo/KVStorage.php @@ -4,7 +4,7 @@ namespace sammo; class KVStorage{ private $storNamespace; private $cacheData = null; - + public function __construct(string $storNamespace, bool $cacheMode=false){ $this->storNamespace = $storNamespace; if($cacheMode){ @@ -30,6 +30,13 @@ class KVStorage{ return $this; } + public function resetValues():self{ + if($this->cacheData !== null){ + $this->cacheData = []; + } + return $this->resetDBNamespace(); + } + public function invalidateCacheValue($key):self{ if($this->cacheData === null){ return $this; @@ -215,4 +222,12 @@ class KVStorage{ ]); return $this; } + + private function resetDBNamespace():self{ + $db = DB::db(); + $db->delete('storage', [ + 'namespace'=>$this->storNamespace + ]); + return $this; + } } \ No newline at end of file