Mercurial > kallithea
comparison rhodecode/lib/dbmigrate/schema/db_1_2_0.py @ 1818:cf51bbfb120e beta
auto white-space removal
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 29 Dec 2011 07:35:51 +0200 |
parents | 8ecc6b8229a5 |
children | 9451a569aee5 |
comparison
equal
deleted
inserted
replaced
1817:523b1011a625 | 1818:cf51bbfb120e |
---|---|
1042 def invalidate(cls, key): | 1042 def invalidate(cls, key): |
1043 """ | 1043 """ |
1044 Returns Invalidation object if this given key should be invalidated | 1044 Returns Invalidation object if this given key should be invalidated |
1045 None otherwise. `cache_active = False` means that this cache | 1045 None otherwise. `cache_active = False` means that this cache |
1046 state is not valid and needs to be invalidated | 1046 state is not valid and needs to be invalidated |
1047 | 1047 |
1048 :param key: | 1048 :param key: |
1049 """ | 1049 """ |
1050 return cls.query()\ | 1050 return cls.query()\ |
1051 .filter(CacheInvalidation.cache_key == key)\ | 1051 .filter(CacheInvalidation.cache_key == key)\ |
1052 .filter(CacheInvalidation.cache_active == False)\ | 1052 .filter(CacheInvalidation.cache_active == False)\ |
1054 | 1054 |
1055 @classmethod | 1055 @classmethod |
1056 def set_invalidate(cls, key): | 1056 def set_invalidate(cls, key): |
1057 """ | 1057 """ |
1058 Mark this Cache key for invalidation | 1058 Mark this Cache key for invalidation |
1059 | 1059 |
1060 :param key: | 1060 :param key: |
1061 """ | 1061 """ |
1062 | 1062 |
1063 log.debug('marking %s for invalidation' % key) | 1063 log.debug('marking %s for invalidation' % key) |
1064 inv_obj = Session.query(cls)\ | 1064 inv_obj = Session.query(cls)\ |
1078 | 1078 |
1079 @classmethod | 1079 @classmethod |
1080 def set_valid(cls, key): | 1080 def set_valid(cls, key): |
1081 """ | 1081 """ |
1082 Mark this cache key as active and currently cached | 1082 Mark this cache key as active and currently cached |
1083 | 1083 |
1084 :param key: | 1084 :param key: |
1085 """ | 1085 """ |
1086 inv_obj = Session.query(CacheInvalidation)\ | 1086 inv_obj = Session.query(CacheInvalidation)\ |
1087 .filter(CacheInvalidation.cache_key == key).scalar() | 1087 .filter(CacheInvalidation.cache_key == key).scalar() |
1088 inv_obj.cache_active = True | 1088 inv_obj.cache_active = True |
1093 __tablename__ = 'db_migrate_version' | 1093 __tablename__ = 'db_migrate_version' |
1094 __table_args__ = {'extend_existing':True} | 1094 __table_args__ = {'extend_existing':True} |
1095 repository_id = Column('repository_id', String(250), primary_key=True) | 1095 repository_id = Column('repository_id', String(250), primary_key=True) |
1096 repository_path = Column('repository_path', Text) | 1096 repository_path = Column('repository_path', Text) |
1097 version = Column('version', Integer) | 1097 version = Column('version', Integer) |
1098 |