changeset 2619:1e4bbff0a6fd

mod_storage_memory: Add :purge() method to all store types
author Matthew Wild <mwild1@gmail.com>
date Tue, 14 Mar 2017 12:59:41 +0000 (2017-03-14)
parents c6652d055ba3
children 8b8cab2eb7fc
files mod_storage_memory/mod_storage_memory.lua
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_memory/mod_storage_memory.lua	Fri Mar 10 10:36:17 2017 +0000
+++ b/mod_storage_memory/mod_storage_memory.lua	Tue Mar 14 12:59:41 2017 +0000
@@ -9,6 +9,11 @@
 
 local NULL = {};
 
+local function _purge_store(self, username)
+	self.store[username or NULL] = nil;
+	return true;
+end
+
 local keyval_store = {};
 keyval_store.__index = keyval_store;
 
@@ -21,6 +26,8 @@
 	return true;
 end
 
+keyval_store.purge = _purge_store;
+
 local map_store = {};
 map_store.__index = map_store;
 
@@ -55,6 +62,8 @@
 	return true;
 end
 
+map_store.purge = _purge_store;
+
 local archive_store = {};
 archive_store.__index = archive_store;
 
@@ -144,6 +153,8 @@
 	return true;
 end
 
+archive_store.purge = _purge_store;
+
 local stores = {
 	keyval = keyval_store;
 	map = map_store;