Mercurial Hosting > luan
diff http/src/luan/modules/http/Http.luan @ 583:1368ca798ccc
add Http.uncache_site
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 31 Jul 2015 19:19:42 -0600 |
parents | 1e69d9c21461 |
children | 24b05963ba62 |
line wrap: on
line diff
--- 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