code: public function getCachedData($affectsSingleRecord, $cacheSettings, \Closure $callback) {
          $defaultTimeout = $affectsSingleRecord
                  ? $this->_getCacheDurationForSelectOneInMinutes()
                  : $this->_getCacheDurationForSelectManyInMinutes();
          $resolvedCacheSettings = $this->resolveCacheSettings(
              $cacheSettings,
              $defaultTimeout,
              function () {
                  throw new \InvalidArgumentException('$cacheSettings must contain a "key" key (if array) or be the cache key (if string)');
              }
          );
          if (is_array($cacheSettings)) {
              return $this->_getCachedData($affectsSingleRecord, $resolvedCacheSettings, $callback);
          } else {
              return $callback();
          }
      }
docs: Get data from cache or put data from $callback to cache (for external use)
  @param bool $affectsSingleRecord
  @param array|string $cacheSettings - array: settings; string: cache key
  array: [
  'key' => 'string, cache key',
  'timeout' => 'int (minutes or unix timestamp), \DateTime, null (infinite)',
  'tags' => ['custom', 'cache', 'tags'],
  'recache' => 'bool, ignore cached data and replace it with fresh data'
  ]
  @param \Closure $callback
  @return array
  @throws \InvalidArgumentException