class_docstr: Memory context to provide caching for interfaces
  
  Parameters
  ==========
  base_dir: string
      The directory name of the location for the caching
  
  Methods
  =======
  cache
      Creates a cacheable function from an nipype Interface class
  clear_previous_runs
      Removes from the disk all the runs that where not used after
      the creation time of the specific Memory instance
  clear_previous_runs
      Removes from the disk all the runs that where not used after
      the given time
class_docstr_tok: ["Memory","context","to","provide","caching","for","interfaces","Parameters","==========","base_dir",":","string","The","directory","name","of","the","location","for","the","caching","Methods","=======","cache","Creates","a","cacheable","function","from","an","nipype","Interface","class","clear_previous_runs","Removes","from","the","disk","all","the","runs","that","where","not","used","after","the","creation","time","of","the","specific","Memory","instance","clear_previous_runs","Removes","from","the","disk","all","the","runs","that","where","not","used","after","the","given","time"]
docstr: Increment counters tracking which cached function get executed.
docstr_tok: ["Increment","counters","tracking","which","cached","function","get","executed","."]
code: def _log_name(self, dir_name, job_name):
      """Increment counters tracking which cached function get executed."""
      base_dir = self.base_dir
      # Every counter is a file opened in append mode and closed
      # immediately to avoid race conditions in parallel computing:
      # file appends are atomic
      with open(
          os.path.join(base_dir, "log.current"), "a"
      ) as currentlog:
          currentlog.write(f"{dir_name}/{job_name}\n")
  
      t = time.localtime()
      year_dir = os.path.join(base_dir, "log.%i" % t.tm_year)
      try:
          os.mkdir(year_dir)
      except OSError:
          "Dir exists"
      month_dir = os.path.join(year_dir, "%02i" % t.tm_mon)
      try:
          os.mkdir(month_dir)
      except OSError:
          "Dir exists"
  
      with open(
          os.path.join(month_dir, "%02i.log" % t.tm_mday), "a"
      ) as rotatefile:
          rotatefile.write(f"{dir_name}/{job_name}\n")
  
imports: import os
  import hashlib
  import pickle
  import time
  import shutil
  import glob
  from ..interfaces.base import BaseInterface
  from ..pipeline.engine import Node
  from ..pipeline.engine.utils import modify_paths
label_desc: Use image node_id 3 for calling the Memory obj's underlying member method code with example usage: obj._log_name(dir_name, job_name) without return types