Commit 385db906 authored by Gerion Entrup's avatar Gerion Entrup
Browse files

caching: add globals for global caching structure

parent 50531464
import sqlalchemy
import threading
dirty_table = {}
dirty_table_lock = threading.RLock()
def is_dirty(table):
global dirty_table
global dirty_table_lock
with dirty_table_lock:
try:
return dirty_table[table]
except KeyError:
dirty_table[table] = False
return False
def set_dirty(table, value=True):
global dirty_table
global dirty_table_lock
if type(table) is sqlalchemy.ext.declarative.api.DeclarativeMeta:
table = table.__tablename__
with dirty_table_lock:
dirty_table[table] = value
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment