linotp.lib.tools.expiring_list module

class linotp.lib.tools.expiring_list.CustomExpiringList

Bases: ExpiringList

A simple item container with expiry time. A janitor runs after every new item is added to clean the expired items up.

add_item(item, expiry=None)

Function to add an Item to the list

Parameters
  • item – the item to be kept

  • ex – expiry in seconds

item_in_list(item)
Returns

True if item is in the list and not expired

class linotp.lib.tools.expiring_list.ExpiringList

Bases: object

An interface class for a general storage of items in which each item has it’s own expiry time

DEFAULT_EXPIRY_IN = 900
add_item(item, expiry)

Function to add an Item to the list

Parameters
  • item – the item to be kept

  • ex – expiry in seconds

item_in_list(item)
Returns

True if item is in the list and not expired