Add a cache_method decorator to cache methods of classes