asset: cachezeit verkürzt
This commit is contained in:
parent
8503fd3e32
commit
0daf39b913
3 changed files with 3 additions and 44 deletions
15
asset.py
15
asset.py
|
@ -8,7 +8,7 @@ from trytond.transaction import Transaction
|
|||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Bool, And, If, Date
|
||||
from trytond.report import Report
|
||||
from trytond.cache import Cache
|
||||
from trytond.cache import MemoryCache
|
||||
|
||||
from decimal import Decimal
|
||||
from datetime import time
|
||||
|
@ -120,7 +120,7 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
readonly=True, model_name='investment.rate'),
|
||||
'get_rate_data')
|
||||
|
||||
_asset_cache = Cache('investment.asset.values', duration=6*3600, context=False)
|
||||
_asset_cache = MemoryCache('investment.asset.values', duration=600, context=False)
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
|
@ -164,17 +164,6 @@ class Asset(SymbolMixin, ModelSQL, ModelView):
|
|||
AssetSourceRel.create(to_create)
|
||||
asset_table.drop_column('updtsource')
|
||||
|
||||
@classmethod
|
||||
def values_cache_clear(cls, id_assets, names):
|
||||
""" set cache-values to None
|
||||
"""
|
||||
for fname in names:
|
||||
for id1 in id_assets:
|
||||
cls._asset_cache.set('%(fname)s-%(id)d' % {
|
||||
'fname': fname,
|
||||
'id': id1,
|
||||
}, None)
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super().view_attributes() + [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue