Args: key(str): A key generated by the QueryCache.get_key() function Returns: Optional(Integer): Unique id of the query in the cache if it exists
(self, key)
| 150 | return self.memory_connection or self.disk_connection |
| 151 | |
| 152 | def key_to_row_id(self, key): |
| 153 | """ |
| 154 | Args: |
| 155 | key(str): A key generated by the QueryCache.get_key() function |
| 156 | Returns: |
| 157 | Optional(Integer): Unique id of the query in the cache if it exists |
| 158 | """ |
| 159 | |
| 160 | cursor = self.connection.cursor() |
| 161 | cursor.execute(""" |
| 162 | SELECT rowid FROM queries where hash_id=(?); |
| 163 | """, (key,)) |
| 164 | row = cursor.fetchone() |
| 165 | return row[0] if row else None |
| 166 | |
| 167 | def put(self, key, processed_query): |
| 168 | """ |