Index: roundup/configuration.py =================================================================== --- roundup/configuration.py (revision 4163) +++ roundup/configuration.py (working copy) @@ -370,7 +370,7 @@ class NullableOption(Option): - """Option that is set to None if it's string value is one of NULL strings + """Option that is set to None if its string value is one of NULL strings Default nullable strings list contains empty string only. There is constructor parameter allowing to specify different nullables. @@ -592,8 +592,10 @@ (NullableOption, 'read_default_group', 'roundup', "Name of the group to use in the MySQL defaults file (.my.cnf).\n" "Only used in MySQL connections."), + (IntegerNumberOption, 'cache_size', '100', + "Size of the node cache (in elements)"), ), "Settings in this section are used" - " by Postgresql and MySQL backends only" + " by RDBMS backends only" ), ("logging", ( (FilePathOption, "config", "", @@ -874,7 +876,7 @@ _options.append(_name) # (section, name) key is used for writing .ini file self.options[(_section, _name)] = option - # make the option known under all of it's A.K.A.s + # make the option known under all of its A.K.A.s for _name in option.aliases: self.options[_name] = option Index: roundup/backends/rdbms_common.py =================================================================== --- roundup/backends/rdbms_common.py (revision 4163) +++ roundup/backends/rdbms_common.py (working copy) @@ -71,9 +71,6 @@ from sessions_rdbms import Sessions, OneTimeKeys from roundup.date import Range -# number of rows to keep in memory -ROW_CACHE_SIZE = 100 - # dummy value meaning "argument not passed" _marker = [] @@ -108,7 +105,7 @@ - some functionality is specific to the actual SQL database, hence the sql_* methods that are NotImplemented - - we keep a cache of the latest ROW_CACHE_SIZE row fetches. + - we keep a cache of the latest N row fetches (where N is configurable). """ def __init__(self, config, journaltag=None): """ Open the database and load the schema from it. @@ -125,6 +122,7 @@ # keep a cache of the N most recently retrieved rows of any kind # (classname, nodeid) = row + self.cache_size = config.RDBMS_CACHE_SIZE self.cache = {} self.cache_lru = [] self.stats = {'cache_hits': 0, 'cache_misses': 0, 'get_items': 0, @@ -1057,7 +1055,7 @@ self.cache[key] = node # update the LRU self.cache_lru.insert(0, key) - if len(self.cache_lru) > ROW_CACHE_SIZE: + if len(self.cache_lru) > self.cache_size: del self.cache[self.cache_lru.pop()] if __debug__: