summaryrefslogtreecommitdiff
path: root/distixlib/ticket_store.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-04-29 20:03:56 +0300
committerLars Wirzenius <liw@liw.fi>2017-04-29 20:03:56 +0300
commit5e7a8c6b497ed7fa7ffac2c0a80244dd3fa85cde (patch)
tree7a790b063df6fe6f034b5e5b635572fae73edf37 /distixlib/ticket_store.py
parentbc8b0b2682522587742ac65091e3ea005c0f94e6 (diff)
downloaddistix-5e7a8c6b497ed7fa7ffac2c0a80244dd3fa85cde.tar.gz
Use lightweight versions of tickets for renderingliw/memopt
This way, we save memory by not having large numbers of Ticket objects in memory at once. Also, only load into memory tickets while they are neeeded.
Diffstat (limited to 'distixlib/ticket_store.py')
-rw-r--r--distixlib/ticket_store.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/distixlib/ticket_store.py b/distixlib/ticket_store.py
index 2343e2e..fdf5b02 100644
--- a/distixlib/ticket_store.py
+++ b/distixlib/ticket_store.py
@@ -74,6 +74,9 @@ class TicketStore(object):
return os.listdir(self._dirname)
return []
+ def clear_ticket_cache(self): # pragma: no cover
+ self._ticket_cache.clear()
+
def get_ticket(self, ticket_id_or_prefix):
'''Return a distixlib.Ticket for an existing ticket in the store.'''
@@ -226,3 +229,6 @@ class _TicketCache(object):
def get_all(self):
return self._known_tickets.values()
+
+ def clear(self): # pragma: no cover
+ self._known_tickets.clear()