Sql optimizations

Few things here in one pull request that reduce sql queries count:
* elgg_get_config was hitting DB every call if value wasn't present in DB - avoided by marking moment when whole existing CONFIG is put to object and this avoiding pointless DB hit https://github.com/Srokap/Elgg/commit/e0315f4c6b628cfdedad6458b68a1a19d3153dfa
* renamed join tables to avoid unnecessary double joining with the same table https://github.com/Srokap/Elgg/commit/6b3de1a43619a9a37bc963ce746b1cb416b78828
* fetching subtypes to cache with single query and than serving from it https://github.com/Srokap/Elgg/commit/5975e0f1f70a6ff5a8c8289bd4cc5ed6477d996a
* caching all private settings on entity level instead of fetching them one by one https://github.com/Srokap/Elgg/commit/93d054e8e2c81207ce39f9d7fb5e0db7ca505fcb

Last commit introduces object ElggLocalCache (of course extends ElggCache) that could be basis to develop more standarized caches at PHP level instead of bare arrays.