Caching role permissions SQL query