# Buggy code
def add(self, name, parse_result):
    """Add the result to the parser cache.

    :param name:
    :type name: str
    :param parse_result:
    :type parse_result: ParseResult
    """
    self._previous_parsed[name] = parse_result
    while len(self._previous_parsed) > self._cache_size:
        del self._previous_parsed[self._previous_parsed.keys()[0]]


# Traceback (KeyError)
2017-01-25 23:16:33 DB       SHOWQUEUE-REFRESH :: [ee778e9] cache.db: SELECT indexer_id, season FROM scene_exceptions WHERE LOWER(show_name) = ? ORDER BY season ASC with args [u'the man in the high castle 2015']
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 73141: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 720p WEB-DL ]
2017-01-25 23:16:33 DB       SHOWQUEUE-REFRESH :: [ee778e9] cache.db: SELECT show_name, indexer_id, season FROM scene_exceptions
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [73141, 13, 14]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 73141: 'American Dad!' S13E14 status is: 'Downloaded (1080p HDTV)'. Accepting result with quality '720p WEB-DL'. Reason: New quality is preferred. Accepting new quality
2017-01-25 23:16:33 INFO     SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Found result American.Dad.S12E14.American.Fung.720p.WEB.DL.DD5.1.H.264-tek54m.English at https://nzb.cat/getnzb/202d14e952e5dbfea304f68c8a339fb1d8561662.nzb&i=5604&r=**********
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'American.Dad.S13E14.720p.WEB-DL.DD5.1.H.264-ViSUM'
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 73141: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 720p WEB-DL ]
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [73141, 13, 14]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 73141: 'American Dad!' S13E14 status is: 'Downloaded (1080p HDTV)'. Accepting result with quality '720p WEB-DL'. Reason: New quality is preferred. Accepting new quality
2017-01-25 23:16:33 INFO     SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Found result American.Dad.S13E14.720p.WEB-DL.DD5.1.H.264-ViSUM at https://nzb.cat/getnzb/13aadd72a86c74b135b68b47576fa1dad6574fb6.nzb&i=5604&r=**********
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'Salem.S03E10.German.HDTVRip.x264-AIDA'
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 274897: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ SDTV ]
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [274897, 3, 10]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 274897: 'Salem' S03E10 status is 'WANTED'. Accepting result with quality 'SDTV'
2017-01-25 23:16:33 INFO     SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Found result Salem.S03E10.German.HDTVRip.x264-AIDA at https://nzb.cat/getnzb/72605ceb5da98b32d4939047c967b84251f1ca11.nzb&i=5604&r=**********
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'Brooklyn.Nine-Nine.S04E11-E12.1080p.HDTV.x264-CRAVERS'
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Parsed 'D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.mkv' into title: The Man in the High Castle, alias: The Man in the High Castle 2015, year: 2015, season: 2, episode: [3], episode_title: Travelers, container: mkv, mimetype: video/x-matroska, type: episode, parsing_time: 0.0699999332428, total_time: 1.68099999428, absolute_episode: [], quality: Unknown
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 269586: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p HDTV ]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] 295829: D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.mkv parsed to The Man in the High Castle S02E03
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [269586, 4, 11]
2017-01-25 23:16:33 DB       SHOWQUEUE-REFRESH :: [ee778e9] main.db: SELECT   * FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [295829, 2, 3]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 269586: 'Brooklyn Nine-Nine' S04E11 status is: 'Downloaded (720p HDTV)'. Ignoring result with quality '1080p HDTV'. Reason: Existing quality is already a preferred quality. Ignoring new quality
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] 295829: Setter sets location to H:\srv\media\series\active\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.mkv
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring Brooklyn.Nine-Nine.S04E11-E12.1080p.HDTV.x264-CRAVERS
2017-01-25 23:16:33 DB       SHOWQUEUE-REFRESH :: [ee778e9] main.db: SELECT last_refreshed FROM xem_refresh WHERE indexer = ? and indexer_id = ? with args [1, 295829]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'Family.Guy.S14E16.The.Heartbreak.Dog.720p.WEB-DL.DD5.1.H.264-CtrlHD'
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if H:\srv\media\series\active\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.nfo exists: True
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 75978: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 720p WEB-DL ]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if H:\srv\media\series\active\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers-thumb.jpg exists: False
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [75978, 14, 16]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] 295829: The old episode had a different file associated with it, re-checking the quality using the new filename D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.mkv
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 75978: 'Family Guy' S14E16 status is: 'Downloaded (1080p HDTV)'. Accepting result with quality '720p WEB-DL'. Reason: New quality is preferred. Accepting new quality
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] 295829: Setter sets location to D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.mkv
2017-01-25 23:16:33 INFO     SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Found result Family.Guy.S14E16.The.Heartbreak.Dog.720p.WEB-DL.DD5.1.H.264-CtrlHD at https://nzb.cat/getnzb/fdb0e0d55e1f4dcdb1530042a7f1767d3e53e7d7.nzb&i=5604&r=**********
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.nfo exists: True
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL'
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers-thumb.jpg exists: False
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p WEB-DL ]
2017-01-25 23:16:33 DB       SHOWQUEUE-REFRESH :: [ee778e9] main.db: SELECT   episode_id,   subtitles FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [295829, 2, 3]
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [248682, 5, 4]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: 'New Girl' S05E04 status is: 'Downloaded (1080p HDTV)'. Ignoring result with quality '1080p WEB-DL'. Reason: New quality is same/lower quality (and not preferred). Ignoring new quality
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL'
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p WEB-DL ]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Transaction with 1 queries executed
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [248682, 5, 4]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.nfo exists: True
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: 'New Girl' S05E04 status is: 'Downloaded (1080p HDTV)'. Ignoring result with quality '1080p WEB-DL'. Reason: New quality is same/lower quality (and not preferred). Ignoring new quality
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers-thumb.jpg exists: False
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for 'New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL'
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p WEB-DL ]
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [248682, 5, 4]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 248682: 'New Girl' S05E04 status is: 'Downloaded (1080p HDTV)'. Ignoring result with quality '1080p WEB-DL'. Reason: New quality is same/lower quality (and not preferred). Ignoring new quality
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring New.Girl.S05E04.No.Girl.1080p.WEB-DL.DD5.1.H.264-NL
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for '[newzNZB]_The.Big.Bang.Theory.S10E10.The.Property.Collision.1080p.WEB-DL.DD5.1.H.264-R2D2'
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 80379: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p WEB-DL ]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Parsed 'D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers' into title: The Man in the High Castle, alias: The Man in the High Castle 2015, year: 2015, season: 2, episode: [3], episode_title: Travelers, type: episode, parsing_time: 0.0789999961853, total_time: 0.0789999961853, absolute_episode: [], quality: Unknown
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [80379, 10, 10]
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 80379: 'The Big Bang Theory' S10E10 status is: 'Downloaded (1080p HDTV)'. Ignoring result with quality '1080p WEB-DL'. Reason: New quality is same/lower quality (and not preferred). Ignoring new quality
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring [newzNZB]_The.Big.Bang.Theory.S10E10.The.Property.Collision.1080p.WEB-DL.DD5.1.H.264-R2D2
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Using cached parse result for '[newzNZB]_The.Big.Bang.Theory.S10E10.The.Property.Collision.1080p.WEB-DL.DD5.1.H264-R2D2'
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Parsed 'The Man In the High Castle - S02E03 - 720p WEBRip x264' into title: The Man In the High Castle, season: 2, episode: [3], screen_size: 720p, format: WEBRip, video_codec: h264, video_encoder: x264, type: episode, parsing_time: 0.0469999313354, total_time: 0.0469999313354, absolute_episode: [], quality: 720p WEB-DL
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 80379: Allowed, Preferred = [ RawHD, 1080p HDTV, 1080p WEB-DL, 1080p BluRay, Unknown ] [ SDTV, SD DVD, 720p HDTV, 720p WEB-DL, 720p BluRay ] Found = [ 1080p WEB-DL ]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Found codec for The Man in the High Castle Travelers
2017-01-25 23:16:33 DB       SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] main.db: SELECT   status,   manually_searched FROM   tv_episodes WHERE   showid = ?   AND season = ?   AND episode = ? with args [80379, 10, 10]
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] 295829: Formatting pattern: %SN - S%0SE%0E - %EN -> The Man in the High Castle - S02E03 - Travelers
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] 80379: 'The Big Bang Theory' S10E10 status is: 'Downloaded (1080p HDTV)'. Ignoring result with quality '1080p WEB-DL'. Reason: New quality is same/lower quality (and not preferred). Ignoring new quality
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Metadata provider KODI 12+ creating episode thumbnail for The Man in the High Castle - S02E03 - Travelers
2017-01-25 23:16:33 DEBUG    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Ignoring [newzNZB]_The.Big.Bang.Theory.S10E10.The.Property.Collision.1080p.WEB-DL.DD5.1.H264-R2D2
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] No thumb is available for this episode, not creating a thumb
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers.nfo exists: True
2017-01-25 23:16:33 DEBUG    SHOWQUEUE-REFRESH :: [ee778e9] Checking if D:\- Series\The Man in the High Castle [2015]\Season 02\The Man in the High Castle - S02E03 - Travelers-thumb.jpg exists: False
2017-01-25 23:16:34 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [NZB.Cat] :: [ee778e9] Error while searching NZB.Cat, skipping: The Simpsons [1989] - S21E08 - Oh Brother, Where Bart Thou
Traceback (most recent call last):
  File "H:\usr\local\medusa\medusa\search\core.py", line 418, in search_for_needed_episodes
    cur_found_results = cur_provider.search_rss(episodes)
  File "H:\usr\local\medusa\medusa\providers\generic_provider.py", line 425, in search_rss
    return self.cache.find_needed_episodes(episodes)
  File "H:\usr\local\medusa\medusa\tv_cache.py", line 463, in find_needed_episodes
    if not show_name_helpers.filterBadReleases(cur_result[b'name']):
  File "H:\usr\local\medusa\medusa\show_name_helpers.py", line 82, in filterBadReleases
    NameParser().parse(name)
  File "H:\usr\local\medusa\medusa\name_parser\parser.py", line 239, in parse
    name_parser_cache.add(name, result)
  File "H:\usr\local\medusa\medusa\name_parser\parser.py", line 430, in add
    del self._previous_parsed[self._previous_parsed.keys()[0]]
  File "C:\Python\latest\lib\collections.py", line 85, in __delitem__
    dict_delitem(self, key)
KeyError: u'The Simpsons [1989] - S21E08 - Oh Brother, Where Bart Thou'

# Fixed code
def add(self, name, parse_result):
    """Add the result to the parser cache.

    :param name:
    :type name: str
    :param parse_result:
    :type parse_result: ParseResult
    """
    while len(self.cache) >= self.max_size:
        self.cache.popitem(last=False)
    self.cache[name] = parse_result