api.py: Cache the result of _get_cache_dir
api.py: Cache the result of _get_cache_dir

_get_cache_dir gets called on every CachedRequest.submit() and it involved
a disk access in _make_dir function. Disk access is slow and does not seem
necessary for every submit.

- Cache the result of _get_cache_dir by letting it overwrite itself on
  first call.

The downside is that users no longer will be able to change the cache
directory dynamically by changing pywikibot.config2.base_dir value, but
I don't see why anyone would want to do that. Therefore, hopefully, this
minor change will not break any code.

Change-Id: Ib5275be8bd8cca7b8f211b137646da613f371328

wikimedia/pywikibot-core,PersianWikipedia/pywikibot-core,wikimedia/pywikibot-core