mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +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
|
# Copyright (c) 2009, James Vega
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
@ -566,8 +566,8 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
self.filename = None
|
self.filename = None
|
||||||
self.users = {}
|
self.users = {}
|
||||||
self.nextId = 0
|
self.nextId = 0
|
||||||
self._nameCache = {}
|
self._nameCache = utils.structures.CacheDict(1000)
|
||||||
self._hostmaskCache = {}
|
self._hostmaskCache = utils.structures.CacheDict(1000)
|
||||||
|
|
||||||
# This is separate because the Creator has to access our instance.
|
# This is separate because the Creator has to access our instance.
|
||||||
def open(self, filename):
|
def open(self, filename):
|
||||||
|
@ -140,7 +140,7 @@ def isChannel(s, chantypes='#&+!', channellen=50):
|
|||||||
len(s) <= channellen and \
|
len(s) <= channellen and \
|
||||||
len(s.split(None, 1)) == 1
|
len(s.split(None, 1)) == 1
|
||||||
|
|
||||||
_patternCache = {}
|
_patternCache = utils.structures.CacheDict(1000) # Arbitrarily chosen.
|
||||||
def _hostmaskPatternEqual(pattern, hostmask):
|
def _hostmaskPatternEqual(pattern, hostmask):
|
||||||
try:
|
try:
|
||||||
return _patternCache[pattern](hostmask) is not None
|
return _patternCache[pattern](hostmask) is not None
|
||||||
@ -168,7 +168,7 @@ def _hostmaskPatternEqual(pattern, hostmask):
|
|||||||
_patternCache[pattern] = f
|
_patternCache[pattern] = f
|
||||||
return f(hostmask) is not None
|
return f(hostmask) is not None
|
||||||
|
|
||||||
_hostmaskPatternEqualCache = {}
|
_hostmaskPatternEqualCache = utils.structures.CacheDict{1000) # Arbitrarily chosen.}
|
||||||
def hostmaskPatternEqual(pattern, hostmask):
|
def hostmaskPatternEqual(pattern, hostmask):
|
||||||
"""pattern, hostmask => bool
|
"""pattern, hostmask => bool
|
||||||
Returns True if hostmask matches the hostmask pattern pattern."""
|
Returns True if hostmask matches the hostmask pattern pattern."""
|
||||||
|
Loading…
Reference in New Issue
Block a user