diff options
author | spag <spag@golwen.net> | 2013-02-07 14:23:26 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-02-07 14:23:26 +0100 |
commit | 9890298bbdfd909ab1fe5f35e53c9652d1371acd (patch) | |
tree | 2598f7d3039f16c866b446d2dd9a5cf3e04bfc3e | |
parent | 26eae9e70097be1cbff8baba9c3641512bcf6635 (diff) |
cache routing tables
-rw-r--r-- | misc/freeswitch/scripts/dialplan/router.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index 0813a37..bda80a7 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -18,11 +18,16 @@ function Router.new(self, arg) self.routes = arg.routes or {}; self.caller = arg.caller; self.variables = arg.variables or {}; + self.routing_tables = {}; return object; end -function Router.read_table(self, table_name) +function Router.read_table(self, table_name, force_reload) + if not force_reload and self.routing_tables[table_name] then + return self.routing_tables[table_name]; + end + local routing_table = {}; local sql_query = 'SELECT * \ @@ -48,6 +53,8 @@ function Router.read_table(self, table_name) }); end); + self.routing_tables[table_name] = routing_table; + return routing_table; end |