equal
deleted
inserted
replaced
75 """ |
75 """ |
76 assert len(args) <= 2 |
76 assert len(args) <= 2 |
77 return cls(*args, **kwargs) |
77 return cls(*args, **kwargs) |
78 |
78 |
79 # Eproperties definition: |
79 # Eproperties definition: |
80 # key: id of the property (the actual EProperty key is build using |
80 # key: id of the property (the actual CWProperty key is build using |
81 # <registry name>.<obj id>.<property id> |
81 # <registry name>.<obj id>.<property id> |
82 # value: tuple (property type, vocabfunc, default value, property description) |
82 # value: tuple (property type, vocabfunc, default value, property description) |
83 # possible types are those used by `logilab.common.configuration` |
83 # possible types are those used by `logilab.common.configuration` |
84 # |
84 # |
85 # notice that when it exists multiple objects with the same id (adaptation, |
85 # notice that when it exists multiple objects with the same id (adaptation, |
130 else: |
130 else: |
131 cache = Cache() |
131 cache = Cache() |
132 CACHE_REGISTRY[cachename] = cache |
132 CACHE_REGISTRY[cachename] = cache |
133 _now = datetime.now() |
133 _now = datetime.now() |
134 if _now > cache.latest_cache_lookup + ONESECOND: |
134 if _now > cache.latest_cache_lookup + ONESECOND: |
135 ecache = self.req.execute('Any C,T WHERE C is ECache, C name %(name)s, C timestamp T', |
135 ecache = self.req.execute('Any C,T WHERE C is CWCache, C name %(name)s, C timestamp T', |
136 {'name':cachename}).get_entity(0,0) |
136 {'name':cachename}).get_entity(0,0) |
137 cache.latest_cache_lookup = _now |
137 cache.latest_cache_lookup = _now |
138 if not ecache.valid(cache.cache_creation_date): |
138 if not ecache.valid(cache.cache_creation_date): |
139 cache.clear() |
139 cache.clear() |
140 cache.cache_creation_date = _now |
140 cache.cache_creation_date = _now |