1from __future__ import unicode_literals 2 3from rbtools.api.cache import clear_cache 4from rbtools.commands import Command, Option 5 6 7class ClearCache(Command): 8 """Delete the HTTP cache used for the API.""" 9 10 name = 'clear-cache' 11 author = 'The Review Board Project' 12 description = 'Delete the HTTP cache used for the API.' 13 14 option_list = [ 15 Option('--cache-location', 16 dest='cache_location', 17 metavar='FILE', 18 config_key='CACHE_LOCATION', 19 default=None, 20 help='The file to use for the API cache database.', 21 added_in='0.7.3'), 22 ] 23 24 def main(self): 25 """Unlink the API cache's path.""" 26 if self.options.cache_location: 27 clear_cache(self.options.cache_location) 28 else: 29 clear_cache() 30