diff --git a/src/main/haxework/storage/IStorage.hx b/src/main/haxework/storage/IStorage.hx index 0655c8c..bddc8aa 100755 --- a/src/main/haxework/storage/IStorage.hx +++ b/src/main/haxework/storage/IStorage.hx @@ -7,5 +7,7 @@ interface IStorage { public function read(key:String):Null; + public function delete(key:String):Void; + public function clear():Void; } diff --git a/src/main/haxework/storage/NoStorage.hx b/src/main/haxework/storage/NoStorage.hx index 3d1ccb5..3856623 100755 --- a/src/main/haxework/storage/NoStorage.hx +++ b/src/main/haxework/storage/NoStorage.hx @@ -13,4 +13,6 @@ class NoStorage implements IStorage { } public function clear():Void {} + + public function delete(key:String):Void {} } diff --git a/src/main/haxework/storage/SharedObjectStorage.hx b/src/main/haxework/storage/SharedObjectStorage.hx index c626e52..9994e5f 100755 --- a/src/main/haxework/storage/SharedObjectStorage.hx +++ b/src/main/haxework/storage/SharedObjectStorage.hx @@ -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(); }