Package mdp :: Package caching :: Class cache
[hide private]
[frames] | no frames]

Class cache


Context manager for the 'cache_execute' extension.

This allows using the caching extension using a 'with' statement, as in:

>>> with mdp.caching.cache(CACHEDIR):                    # doctest: +SKIP
...     # 'node' is executed caching the results in CACHEDIR
...     node.execute(x)

If the argument to the context manager is not specified, caching is done in a temporary directory.

Instance Methods [hide private]
 
__enter__(self)
 
__exit__(self, type, value, traceback)
 
__init__(self, cachedir=None, cache_classes=None, cache_instances=None, verbose=0)
Activate caching extension.

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__enter__(self)

 

__exit__(self, type, value, traceback)

 

__init__(self, cachedir=None, cache_classes=None, cache_instances=None, verbose=0)
(Constructor)

 

Activate caching extension.

By default, the cache is activated globally (i.e., for all instances of Node). If cache_classes or cache instances are specified, the cache is activated only for those classes and instances.

Parameters:
  • cachedir - The root of the joblib cache, or a temporary directory if None
  • cache_classes - A list of Node subclasses for which caching is activated. Default value: None
  • cache_classes - A list of Node instances for which caching is activated. Default value: None
Overrides: object.__init__