changeset 583:1368ca798ccc

add Http.uncache_site
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 31 Jul 2015 19:19:42 -0600
parents 31926755689e
children 0742ac78fa69
files http/src/luan/modules/http/Http.luan
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r 31926755689e -r 1368ca798ccc http/src/luan/modules/http/Http.luan
--- a/http/src/luan/modules/http/Http.luan	Fri Jul 31 06:20:17 2015 -0600
+++ b/http/src/luan/modules/http/Http.luan	Fri Jul 31 19:19:42 2015 -0600
@@ -9,6 +9,9 @@
 local url_encode = Html.url_encode or error()
 local Table = require "luan:Table"
 local clear = Table.clear or error()
+local Package = require "luan:Package"
+local String = require "luan:String"
+local matches = String.matches or error()
 local HttpServicer = require "java:luan.modules.http.HttpServicer"
 local IoLuan = require "java:luan.modules.IoLuan"
 
@@ -149,4 +152,12 @@
 end
 
 
+function M.uncache_site()
+	for k in pairs(Table.copy(Package.loaded)) do
+		if matches(k,"site:.*") then
+			Package.loaded[k] = nil
+		end
+	end
+end
+
 return M