cache_translation

astro_metadata_translator.cache_translation(func, method=None)

Decorator to cache the result of a translation method.

Especially useful when a translation uses many other translation methods. Should be used only on to_x() methods.

Parameters:
func : function

Translation method to cache.

method : str, optional

Name of the translation method to cache. Not needed if the decorator is used around a normal method, but necessary when the decorator is being used in a metaclass.

Returns:
wrapped : function

Method wrapped by the caching function.