summaryrefslogtreecommitdiff
path: root/odoo/modules
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-03-28 18:05:31 +0200
committerChristophe Simonis <chs@odoo.com>2017-03-28 18:05:31 +0200
commit2df5faa551112d0bde9c30a8e6f0536fb7bf21d3 (patch)
treee0b09fe7efc2f983075ba742aed97daa5245dd39 /odoo/modules
parentad811b19a0b88366cfe2cd28c2cd871d27107408 (diff)
parent2f68e9e93a11f37241c1be2835e74ff8be95db1d (diff)
[MERGE] forward port branch saas-14 up to 2f68e9e93a1
Diffstat (limited to 'odoo/modules')
-rw-r--r--odoo/modules/registry.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py
index a6ab4ead1b4..8ff70b84eb1 100644
--- a/odoo/modules/registry.py
+++ b/odoo/modules/registry.py
@@ -8,6 +8,7 @@ from collections import Mapping, defaultdict, deque
from contextlib import closing
from functools import partial
from operator import attrgetter
+from weakref import WeakValueDictionary
import logging
import os
import threading
@@ -31,6 +32,9 @@ class Registry(Mapping):
_lock = threading.RLock()
_saved_lock = None
+ # a cache for model classes, indexed by their base classes
+ model_cache = WeakValueDictionary()
+
@lazy_classproperty
def registries(cls):
""" A mapping from database names to registries. """
@@ -180,12 +184,6 @@ class Registry(Mapping):
""" Add or replace a model in the registry."""
self.models[model_name] = model
- @lazy_classproperty
- def model_cache(cls):
- """ A cache for model classes, indexed by their base classes. """
- # we cache 256 classes per registry on average
- return LRU(cls.registries.count * 256)
-
@lazy_property
def field_sequence(self):
""" Return a function mapping a field to an integer. The value of a