Added caching.
Better cache key.
Small logic fix.
Added a gateways table to tenant#view.
Merge branch 'gateways_table' into develop