[storage] add delete method
This commit is contained in:
@@ -7,5 +7,7 @@ interface IStorage {
|
||||
|
||||
public function read<T>(key:String):Null<T>;
|
||||
|
||||
public function delete(key:String):Void;
|
||||
|
||||
public function clear():Void;
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ class NoStorage implements IStorage {
|
||||
}
|
||||
|
||||
public function clear():Void {}
|
||||
|
||||
public function delete(key:String):Void {}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user