public function create_cache(cache_definition $definition) {
        $class = $definition->get_cache_class();
        $stores = cache_helper::get_stores_suitable_for_definition($definition);
        foreach ($stores as $key => $store) {
            if (!$store::are_requirements_met()) {
                unset($stores[$key]);
            }
        }
        if (count($stores) === 0) {
            // Hmm still no stores, better provide a dummy store to mimic functionality. The dev will be none the wiser.
            $stores[] = $this->create_dummy_store($definition);
        }
        $loader = null;
        if ($definition->has_data_source()) {
            $loader = $definition->get_data_source();
        }
        while (($store = array_pop($stores)) !== null) {
            $loader = new $class($definition, $store, $loader);
        }
        return $loader;
    }