I'll let others tackle your security question. On the cached dataset, why not use a
in-memory table. That way you just import from MySQL straight into an in-memory table and then query that table with SQL just as you'd query the actual MySQL table. Pair networks (our kind hosts) uses this technique. See