| Total Complexity | 2 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Chalice Routen für Caching |
||
| 3 | """ |
||
| 4 | |||
| 5 | __author__ = "Glücks GmbH - Frederik Glücks" |
||
| 6 | __email__ = "[email protected]" |
||
| 7 | __copyright__ = "Frederik Glücks - Glücks GmbH" |
||
| 8 | |||
| 9 | # Generic/Built-in Imports |
||
| 10 | |||
| 11 | # External libs/modules |
||
| 12 | from chalice import Blueprint |
||
| 13 | |||
| 14 | # Own libs/modules |
||
| 15 | from luckywood import DataCaching |
||
| 16 | |||
| 17 | |||
| 18 | data_caching_routes = Blueprint(__name__) |
||
| 19 | |||
| 20 | |||
| 21 | @data_caching_routes.route('/cache', methods=['DELETE']) |
||
| 22 | def cache_clear(): |
||
| 23 | """ |
||
| 24 | Clear the complete data cache and returns the number of |
||
| 25 | deleted objects |
||
| 26 | |||
| 27 | :return: json |
||
| 28 | """ |
||
| 29 | |||
| 30 | return { |
||
| 31 | "cleared": DataCaching.clear() |
||
| 32 | } |
||
| 33 | |||
| 34 | |||
| 35 | @data_caching_routes.route('/cache', methods=['GET']) |
||
| 36 | def get_cache_statistic(): |
||
| 37 | """ |
||
| 38 | Returns a statistic of cached objects |
||
| 39 | |||
| 40 | :return: json |
||
| 41 | """ |
||
| 42 | return DataCaching.get_statistic() |
||
| 43 |