| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """This module provides a decorator to cache the results of a function. | 5 """This module provides a decorator to cache the results of a function. |
| 6 | 6 |
| 7 Examples: | 7 Examples: |
| 8 1. Decorate a function: | 8 1. Decorate a function: |
| 9 @cache_decorator.Cached() | 9 @cache_decorator.Cached() |
| 10 def Test(a): | 10 def Test(a): |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 except Exception: # pragma: no cover. | 127 except Exception: # pragma: no cover. |
| 128 logging.exception( | 128 logging.exception( |
| 129 'Failed to cache data for function %s.%s, args=%s, kwargs=%s', | 129 'Failed to cache data for function %s.%s, args=%s, kwargs=%s', |
| 130 func.__module__, func.__name__, repr(args), repr(kwargs)) | 130 func.__module__, func.__name__, repr(args), repr(kwargs)) |
| 131 | 131 |
| 132 return result | 132 return result |
| 133 | 133 |
| 134 return Wrapped | 134 return Wrapped |
| 135 | 135 |
| 136 return Decorator | 136 return Decorator |
| OLD | NEW |