remove caching
This commit is contained in:
parent
c6478add0f
commit
345cef4c8b
5 changed files with 10 additions and 258 deletions
23
currency.py
23
currency.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
|
||||
from .model import CACHEKEY_CURRENCY
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class CurrencyRate(metaclass=PoolMeta):
|
||||
|
@ -14,36 +13,22 @@ class CurrencyRate(metaclass=PoolMeta):
|
|||
def create(cls, vlist):
|
||||
""" update cache-value
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
records = super(CurrencyRate, cls).create(vlist)
|
||||
for rate in records:
|
||||
MemCache.record_update(CACHEKEY_CURRENCY % rate.currency.id, rate)
|
||||
# TODO: update cashbooks using this rate
|
||||
return records
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
""" update cache-value
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
super(CurrencyRate, cls).write(*args)
|
||||
|
||||
actions = iter(args)
|
||||
for rates, values in zip(actions, actions):
|
||||
for rate in rates:
|
||||
MemCache.record_update(
|
||||
CACHEKEY_CURRENCY % rate.currency.id, rate)
|
||||
# TODO: update cashbooks using this rate
|
||||
|
||||
@classmethod
|
||||
def delete(cls, records):
|
||||
""" set cache to None
|
||||
"""
|
||||
MemCache = Pool().get('cashbook.memcache')
|
||||
|
||||
for record in records:
|
||||
MemCache.record_update(
|
||||
CACHEKEY_CURRENCY % record.currency.id, None)
|
||||
super(CurrencyRate, cls).delete(records)
|
||||
# TODO: update cashbooks using this rate
|
||||
|
||||
# end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue