remove caching
This commit is contained in:
parent
7f49602518
commit
40dbbd1a6b
3 changed files with 9 additions and 119 deletions
21
asset.py
21
asset.py
|
@ -3,8 +3,7 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the
|
||||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
CACHEKEY_ASSETRATE = 'assetrate-%s'
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class AssetRate(metaclass=PoolMeta):
|
||||
|
@ -14,34 +13,22 @@ class AssetRate(metaclass=PoolMeta):
|
|||
def create(cls, vlist):
|
||||
""" update cache-value
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
records = super(AssetRate, cls).create(vlist)
|
||||
for rate in records:
|
||||
MemCache.record_update(CACHEKEY_ASSETRATE % rate.asset.id, rate)
|
||||
# TODO: update cashbooks using this asset
|
||||
return records
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
""" update cache-value
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
super(AssetRate, cls).write(*args)
|
||||
|
||||
actions = iter(args)
|
||||
for rates, values in zip(actions, actions):
|
||||
for rate in rates:
|
||||
MemCache.record_update(CACHEKEY_ASSETRATE % rate.asset.id, rate)
|
||||
# TODO: update cashbooks using this asset
|
||||
|
||||
@classmethod
|
||||
def delete(cls, records):
|
||||
""" set cache to None
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
for record in records:
|
||||
MemCache.record_update(CACHEKEY_ASSETRATE % record.asset.id, None)
|
||||
super(AssetRate, cls).delete(records)
|
||||
# TODO: update cashbooks using this asset
|
||||
|
||||
# end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue