Project

General

Profile

« Previous | Next » 

Revision 2047

sql.py: Make caching DbConn enablable. Turn caching off by default because recent benchmarks (n=1000) were showing that it slows things down.

View differences:

sql.py
96 96
log_debug_none = lambda msg: None
97 97

  
98 98
class DbConn:
99
    def __init__(self, db_config, serializable=True, log_debug=log_debug_none):
99
    def __init__(self, db_config, serializable=True, log_debug=log_debug_none,
100
        caching=False):
100 101
        self.db_config = db_config
101 102
        self.serializable = serializable
102 103
        self.log_debug = log_debug
104
        self.caching = caching
103 105
        
104 106
        self.__db = None
105 107
        self.query_results = {}
......
186 188
                except StopIteration: return None
187 189
    
188 190
    def run_query(self, query, params=None, cacheable=False):
191
        if not self.caching: cacheable = False
189 192
        used_cache = False
190 193
        try:
191 194
            # Get cursor

Also available in: Unified diff