class_docstr: Represents a persisted graph component in the graph.
  
  Attributes:
      name: The unique identifier for the `Resource`. Used to locate the associated
          data from a `ModelStorage`. Normally matches the name of the node which
          created it.
      output_fingerprint: An unique identifier for a specific instantiation of a
          `Resource`. Used to distinguish a specific persistence for the same
          `Resource` when saving to the cache.
class_docstr_tok: ["Represents","a","persisted","graph","component","in","the","graph",".","Attributes",":","name",":","The","unique","identifier","for","the","`","Resource","`",".","Used","to","locate","the","associated","data","from","a","`","ModelStorage","`",".","Normally","matches","the","name","of","the","node","which","created","it",".","output_fingerprint",":","An","unique","identifier","for","a","specific","instantiation","of","a","`","Resource","`",".","Used","to","distinguish","a","specific","persistence","for","the","same","`","Resource","`","when","saving","to","the","cache","."]
docstr: Persists the `Resource` to the cache.
  
  Args:
      directory: The directory which receives the persisted `Resource`.
      model_storage: The model storage which currently contains the persisted
          `Resource`.
docstr_tok: ["Persists","the","`","Resource","`","to","the","cache",".","Args",":","directory",":","The","directory","which","receives","the","persisted","`","Resource","`",".","model_storage",":","The","model","storage","which","currently","contains","the","persisted","`","Resource","`","."]
code: def to_cache(
      self, directory: Path, model_storage: ModelStorage
  ) -> None:
      """Persists the `Resource` to the cache.
  
      Args:
          directory: The directory which receives the persisted `Resource`.
          model_storage: The model storage which currently contains the persisted
              `Resource`.
      """
      try:
          with model_storage.read_from(self) as resource_directory:
              rasa.utils.common.copy_directory(
                  resource_directory, directory
              )
      except ValueError:
          logger.debug(
              f"Skipped caching resource '{self.name}' as no persisted "
              f"data was found."
          )
  
file_path: rasa/rasa/engine/storage/resource.py
imports: from __future__ import annotations
  import logging
  import typing
  from dataclasses import dataclass, field
  from pathlib import Path
  from typing import Text
  import uuid
  import rasa.utils.common
  import rasa.utils.io
label_desc: Use image node_id 2 for calling the Resource obj's underlying member method code with example usage: obj.to_cache(directory, model_storage) without return types