[storage] add delete method

This commit is contained in:
2019-05-13 22:35:46 +03:00
parent 53460a1ad6
commit 349916e504
3 changed files with 11 additions and 0 deletions

View File

@@ -7,5 +7,7 @@ interface IStorage {
public function read<T>(key:String):Null<T>;
public function delete(key:String):Void;
public function clear():Void;
}

View File

@@ -13,4 +13,6 @@ class NoStorage implements IStorage {
}
public function clear():Void {}
public function delete(key:String):Void {}
}

View File

@@ -30,6 +30,13 @@ class SharedObjectStorage implements IStorage {
}
}
public function delete(key:String):Void {
if (exists(key)) {
Reflect.deleteField(so.data, key);
so.flush();
}
}
public function clear():Void {
so.clear();
}