'Retrieves the value from cache for the given name.'

def _get_cache(self, name, default=None):

    if self.config.has_option('defaults', 'cache_dir'):
        cache_dir = self.config.get('defaults', 'cache_dir')
        cache_file = os.path.join(cache_dir, name)
        if os.path.exists(cache_file):
            if self.config.has_option('defaults', 'cache_max_age'):
                cache_max_age = self.config.getint('defaults', 'cache_max_age')
            else:
                cache_max_age = 0
            cache_stat = os.stat(cache_file)
            if ((cache_stat.st_mtime + cache_max_age) >= time.time()):
                with open(cache_file) as cache:
                    return json.load(cache)
    return default
