Last change
on this file since 1381 was
1381,
checked in by piv, 14 years ago
|
merge from 2.1 branch, this adds flushcache section
|
File size:
837 bytes
|
Line | |
---|
1 | import transaction |
---|
2 | from zope.interface import classProvides, implements |
---|
3 | from collective.transmogrifier.interfaces import ISectionBlueprint |
---|
4 | from collective.transmogrifier.interfaces import ISection |
---|
5 | |
---|
6 | class FlushCacheSection(object): |
---|
7 | classProvides(ISectionBlueprint) |
---|
8 | implements(ISection) |
---|
9 | |
---|
10 | def __init__(self, transmogrifier, name, options, previous): |
---|
11 | self.every = int(options.get('every', 1000)) |
---|
12 | self.previous = previous |
---|
13 | self.context = transmogrifier.context |
---|
14 | |
---|
15 | def __iter__(self): |
---|
16 | count = 0 |
---|
17 | for item in self.previous: |
---|
18 | count = (count + 1) % self.every |
---|
19 | if count == 0: |
---|
20 | [self.context.Control_Panel.Database[x]._getDB().cacheMinimize() \ |
---|
21 | for x in self.context.Control_Panel.Database.getDatabaseNames()] |
---|
22 | yield item |
---|
Note: See
TracBrowser
for help on using the repository browser.