mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Changed a few caches to use CacheDict to ensure no without-bound growth on caches.
This commit is contained in:
parent
757991afc9
commit
dd4bc64e32
@ -1,5 +1,5 @@
|
||||
###
|
||||
# Copyright (c) 2002-2005, Jeremiah Fincher
|
||||
# Copyright (c) 2002-2009, Jeremiah Fincher
|
||||
# Copyright (c) 2009, James Vega
|
||||
# All rights reserved.
|
||||
#
|
||||
@ -566,8 +566,8 @@ class UsersDictionary(utils.IterableMap):
|
||||
self.filename = None
|
||||
self.users = {}
|
||||
self.nextId = 0
|
||||
self._nameCache = {}
|
||||
self._hostmaskCache = {}
|
||||
self._nameCache = utils.structures.CacheDict(1000)
|
||||
self._hostmaskCache = utils.structures.CacheDict(1000)
|
||||
|
||||
# This is separate because the Creator has to access our instance.
|
||||
def open(self, filename):
|
||||
|
@ -140,7 +140,7 @@ def isChannel(s, chantypes='#&+!', channellen=50):
|
||||
len(s) <= channellen and \
|
||||
len(s.split(None, 1)) == 1
|
||||
|
||||
_patternCache = {}
|
||||
_patternCache = utils.structures.CacheDict(1000) # Arbitrarily chosen.
|
||||
def _hostmaskPatternEqual(pattern, hostmask):
|
||||
try:
|
||||
return _patternCache[pattern](hostmask) is not None
|
||||
@ -168,7 +168,7 @@ def _hostmaskPatternEqual(pattern, hostmask):
|
||||
_patternCache[pattern] = f
|
||||
return f(hostmask) is not None
|
||||
|
||||
_hostmaskPatternEqualCache = {}
|
||||
_hostmaskPatternEqualCache = utils.structures.CacheDict{1000) # Arbitrarily chosen.}
|
||||
def hostmaskPatternEqual(pattern, hostmask):
|
||||
"""pattern, hostmask => bool
|
||||
Returns True if hostmask matches the hostmask pattern pattern."""
|
||||
|
Loading…
Reference in New Issue
Block a user