class_docstr: Cache values based on a key object (such as a sphere or gradient table).
  
  Notes
  -----
  This class is meant to be used as a mix-in::
  
      class MyModel(Model, Cache):
          pass
  
      class MyModelFit(Fit):
          pass
  
  Inside a method on the fit, typical usage would be::
  
      def odf(sphere):
          M = self.model.cache_get('odf_basis_matrix', key=sphere)
  
          if M is None:
              M = self._compute_basis_matrix(sphere)
              self.model.cache_set('odf_basis_matrix', key=sphere, value=M)
class_docstr_tok: ["Cache","values","based","on","a","key","object","(","such","as","a","sphere","or","gradient","table",")",".","Notes","--","--","-","This","class","is","meant","to","be","used","as","a","mix-in",":",":","class","MyModel","(","Model",",","Cache",")",":","pass","class","MyModelFit","(","Fit",")",":","pass","Inside","a","method","on","the","fit",",","typical","usage","would","be",":",":","def","odf","(","sphere",")",":","M","=","self.model.cache_get","(","'odf_basis_matrix","'",",","key=sphere",")","if","M","is","None",":","M","=","self._compute_basis_matrix","(","sphere",")","self.model.cache_set","(","'odf_basis_matrix","'",",","key=sphere",",","value=M",")"]
docstr: Retrieve a value from the cache.
  
  Parameters
  ----------
  tag : str
      Description of the cached value.
  key : object
      Key object used to look up the cached value.
  default : object
      Value to be returned if no cached entry is found.
  
  Returns
  -------
  v : object
      Value from the cache associated with ``(tag, key)``.  Returns
      `default` if no cached entry is found.
docstr_tok: ["Retrieve","a","value","from","the","cache",".","Parameters","--","--","--","--","--","tag",":","str","Description","of","the","cached","value",".","key",":","object","Key","object","used","to","look","up","the","cached","value",".","default",":","object","Value","to","be","returned","if","no","cached","entry","is","found",".","Returns","--","--","--","-","v",":","object","Value","from","the","cache","associated","with","``","(","tag",",","key",")","``",".","Returns","`","default","`","if","no","cached","entry","is","found","."]
code: def cache_get(self, tag, key, default=None):
      """Retrieve a value from the cache.
  
      Parameters
      ----------
      tag : str
          Description of the cached value.
      key : object
          Key object used to look up the cached value.
      default : object
          Value to be returned if no cached entry is found.
  
      Returns
      -------
      v : object
          Value from the cache associated with ``(tag, key)``.  Returns
          `default` if no cached entry is found.
  
      """
      return self._cache.get((tag, key), default)
  
imports: from dipy.core.onetime import auto_attr
label_desc: Use image node_id 3 for calling the Cache obj's underlying member method code with example usage: obj.cache_get(tag, key, default) and returns: self