class_docstr: 'safe' version of the least-recently-used (LRU) cache decorator.
  
  This decorator memoizes a function's return value each time it is called.
  If called later with the same arguments, the cached value is returned, and
  not re-evaluated.  To avoid memory issues, a maximum cache size is imposed.
  For caches with an archive, the full cache dumps to archive upon reaching
  maxsize. For caches without an archive, the LRU algorithm manages the cache.
  Caches with an archive will use the latter behavior when 'purge' is False.
  This decorator takes an integer tolerance 'tol', equal to the number of
  decimal places to which it will round off floats, and a bool 'deep' for
  whether the rounding on inputs will be 'shallow' or 'deep'.  Note that
  rounding is not applied to the calculation of new results, but rather as a
  simple form of cache interpolation.  For example, with tol=0 and a cached
  value for f(3.0), f(3.1) will lookup f(3.0) in the cache while f(3.6) will
  store a new value; however if tol=1, both f(3.1) and f(3.6) will store
  new values.
  
  maxsize = maximum cache size
  cache = storage hashmap (default is {})
  keymap = cache key encoder (default is keymaps.stringmap(flat=False))
  ignore = function argument names and indicies to 'ignore' (default is None)
  tol = integer tolerance for rounding (default is None)
  deep = boolean for rounding depth (default is False, i.e. 'shallow')
  purge = boolean for purge cache to archive at maxsize (default is False)
  
  If *maxsize* is None, this cache will grow without bound.
  
  If *keymap* is given, it will replace the hashing algorithm for generating
  cache keys.  Several hashing algorithms are available in 'keymaps'. The
  default keymap does not require arguments to the cached function to be
  hashable.  If a hashing error occurs, the cached function will be evaluated.
  
  If the keymap retains type information, then arguments of different types
  will be cached separately.  For example, f(3.0) and f(3) will be treated
  as distinct calls with distinct results.  Cache typing has a memory penalty,
  and may also be ignored by some 'keymaps'.
  
  If *ignore* is given, the keymap will ignore the arguments with the names
  and/or positional indicies provided. For example, if ignore=(0,), then
  the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
  If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
  to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
  and varkwds will be 'ignored'.  Ignored arguments never trigger a
  recalculation (they only trigger cache lookups), and thus are 'ignored'.
  When caching class methods, it may be useful to ignore=('self',).
  
  View cache statistics (hit, miss, load, maxsize, size) with f.info().
  Clear the cache and statistics with f.clear().  Replace the cache archive
  with f.archive(obj).  Load from the archive with f.load(), and dump from
  the cache to the archive with f.dump().
  
  See: http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
class_docstr_tok: ["'safe","'","version","of","the","least-recently-used","(","LRU",")","cache","decorator",".","This","decorator","memoizes","a","function","'s","return","value","each","time","it","is","called",".","If","called","later","with","the","same","arguments",",","the","cached","value","is","returned",",","and","not","re-evaluated",".","To","avoid","memory","issues",",","a","maximum","cache","size","is","imposed",".","For","caches","with","an","archive",",","the","full","cache","dumps","to","archive","upon","reaching","maxsize",".","For","caches","without","an","archive",",","the","LRU","algorithm","manages","the","cache",".","Caches","with","an","archive","will","use","the","latter","behavior","when","'purge","'","is","False",".","This","decorator","takes","an","integer","tolerance","'tol","'",",","equal","to","the","number","of","decimal","places","to","which","it","will","round","off","floats",",","and","a","bool","'deep","'","for","whether","the","rounding","on","inputs","will","be","'shallow","'","or","'deep","'",".","Note","that","rounding","is","not","applied","to","the","calculation","of","new","results",",","but","rather","as","a","simple","form","of","cache","interpolation",".","For","example",",","with","tol=0","and","a","cached","value","for","f","(","3.0",")",",","f","(","3.1",")","will","lookup","f","(","3.0",")","in","the","cache","while","f","(","3.6",")","will","store","a","new","value",";","however","if","tol=1",",","both","f","(","3.1",")","and","f","(","3.6",")","will","store","new","values",".","maxsize","=","maximum","cache","size","cache","=","storage","hashmap","(","default","is","{","}",")","keymap","=","cache","key","encoder","(","default","is","keymaps.stringmap","(","flat=False",")",")","ignore","=","function","argument","names","and","indicies","to","'ignore","'","(","default","is","None",")","tol","=","integer","tolerance","for","rounding","(","default","is","None",")","deep","=","boolean","for","rounding","depth","(","default","is","False",",","i.e",".","'shallow","'",")","purge","=","boolean","for","purge","cache","to","archive","at","maxsize","(","default","is","False",")","If","*","maxsize","*","is","None",",","this","cache","will","grow","without","bound",".","If","*","keymap","*","is","given",",","it","will","replace","the","hashing","algorithm","for","generating","cache","keys",".","Several","hashing","algorithms","are","available","in","'keymaps","'",".","The","default","keymap","does","not","require","arguments","to","the","cached","function","to","be","hashable",".","If","a","hashing","error","occurs",",","the","cached","function","will","be","evaluated",".","If","the","keymap","retains","type","information",",","then","arguments","of","different","types","will","be","cached","separately",".","For","example",",","f","(","3.0",")","and","f","(","3",")","will","be","treated","as","distinct","calls","with","distinct","results",".","Cache","typing","has","a","memory","penalty",",","and","may","also","be","ignored","by","some","'keymaps","'",".","If","*","ignore","*","is","given",",","the","keymap","will","ignore","the","arguments","with","the","names","and\/or","positional","indicies","provided",".","For","example",",","if","ignore=","(","0",",",")",",","then","the","key","generated","for","f","(","1,2",")","will","be","identical","to","that","of","f","(","3,2",")","or","f","(","4,2",")",".","If","ignore=","(","'","y","'",",",")",",","then","the","key","generated","for","f","(","x=3",",","y=4",")","will","be","identical","to","that","of","f","(","x=3",",","y=0",")","or","f","(","x=3",",","y=10",")",".","If","ignore=","(","'","*","'",",","'","*","*","'",")",",","all","varargs","and","varkwds","will","be","'ignored","'",".","Ignored","arguments","never","trigger","a","recalculation","(","they","only","trigger","cache","lookups",")",",","and","thus","are","'ignored","'",".","When","caching","class","methods",",","it","may","be","useful","to","ignore=","(","'self","'",",",")",".","View","cache","statistics","(","hit",",","miss",",","load",",","maxsize",",","size",")","with","f.info","(",")",".","Clear","the","cache","and","statistics","with","f.clear","(",")",".","Replace","the","cache","archive","with","f.archive","(","obj",")",".","Load","from","the","archive","with","f.load","(",")",",","and","dump","from","the","cache","to","the","archive","with","f.dump","(",")",".","See",":","http",":","\/\/en.wikipedia.org\/wiki\/Cache_algorithms","#","Least_Recently_Used"]
code: def __new__(cls, *args, **kwds):
      maxsize = kwds.get("maxsize", -1)
      if maxsize == 0:
          return no_cache(*args, **kwds)
      if maxsize is None:
          return inf_cache(*args, **kwds)
      return object.__new__(cls)
  
imports: from functools import update_wrapper, partial
  from klepto.archives import cache
  from klepto.keymaps import stringmap
  from klepto.tools import CacheInfo
  from klepto.rounding import deep_round, simple_round
  from ._inspect import _keygen
label_desc: Use image node_id 1 for calling the lru_cache obj's underlying member method code with example usage: obj.__new__(cls) and returns: object, no_cache, inf_cache