[repo cache] there are some relations we don't want to cache, they may cause memory leak
--- a/server/repository.py Wed May 11 19:02:27 2011 +0200
+++ b/server/repository.py Wed May 11 19:03:16 2011 +0200
@@ -59,13 +59,18 @@
security_enabled
from cubicweb.server.ssplanner import EditedEntity
+NO_CACHE_RELATIONS = set( [('require_permission', 'object'),
+ ('owned_by', 'object'),
+ ('created_by', 'object'),
+ ('cw_source', 'object'),
+ ])
def prefill_entity_caches(entity, relations):
session = entity._cw
# prefill entity relation caches
for rschema in entity.e_schema.subject_relations():
rtype = str(rschema)
- if rtype in schema.VIRTUAL_RTYPES:
+ if rtype in schema.VIRTUAL_RTYPES or (rtype, 'subject') in NO_CACHE_RELATIONS:
continue
if rschema.final:
entity.cw_attr_cache.setdefault(rtype, None)
@@ -74,7 +79,7 @@
session.empty_rset())
for rschema in entity.e_schema.object_relations():
rtype = str(rschema)
- if rtype in schema.VIRTUAL_RTYPES:
+ if rtype in schema.VIRTUAL_RTYPES or (rtype, 'object') in NO_CACHE_RELATIONS:
continue
entity.cw_set_relation_cache(rtype, 'object', session.empty_rset())
# set inlined relation cache before call to after_add_entity