KVStorage에 reset추가
This commit is contained in:
+16
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user