Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
erp5
Commits
33c86fbb
Commit
33c86fbb
authored
Jun 12, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: CacheTool
parent
e5587493
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
181 additions
and
10 deletions
+181
-10
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+7
-1
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+0
-1
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.py
...nentTemplateItem/portal_components/tool.erp5.CacheTool.py
+4
-5
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.xml
...entTemplateItem/portal_components/tool.erp5.CacheTool.xml
+110
-0
product/ERP5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml
...P5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml
+56
-0
product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list
...P5/bootstrap/erp5_core/bt/template_tool_component_id_list
+1
-0
product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list
product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list
+1
-0
product/ERP5Type/__init__.py
product/ERP5Type/__init__.py
+2
-3
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
33c86fbb
...
...
@@ -5496,7 +5496,13 @@ Business Template is a set of definitions, such as skins, portal types and categ
site
.
ERP5Site_updateTranslationTable
()
# Clear cache to avoid reusing cached values with replaced objects.
site
.
portal_caches
.
clearAllCache
()
try
:
cache_tool
=
site
.
portal_caches
except
AttributeError
:
# Only happen when installing erp5_core shipping portal_caches
pass
else
:
cache_tool
.
clearAllCache
()
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'install'
)
install
=
_install
...
...
product/ERP5/ERP5Site.py
View file @
33c86fbb
...
...
@@ -2093,7 +2093,6 @@ class ERP5Generator(PortalGenerator):
addERP5Tool
(
p
,
'portal_alarms'
,
'Alarm Tool'
)
# Add ERP5Type Tool
addERP5Tool
(
p
,
'portal_caches'
,
'Cache Tool'
)
addERP5Tool
(
p
,
'portal_memcached'
,
'Memcached Tool'
)
# Add erp5 catalog tool
...
...
product/ERP5
Type/Tool/
CacheTool.py
→
product/ERP5
/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.
CacheTool.py
View file @
33c86fbb
...
...
@@ -33,7 +33,7 @@ import transaction
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Globals
import
InitializeClass
,
DTMLFile
,
PersistentMapping
from
Products.ERP5Type.Globals
import
DTMLFile
from
Products.ERP5Type
import
_dtmldir
from
Products.ERP5Type.Cache
import
CacheFactory
from
Products.ERP5Type.Cache
import
CachingMethod
...
...
@@ -69,9 +69,9 @@ class CacheTool(BaseTool):
def
getRamCachePlugin
(
cp
):
cp_meta_type
=
cp
.
meta_type
id
=
cp
.
getCacheId
()
id
_
=
cp
.
getCacheId
()
if
cp_meta_type
==
'ERP5 Ram Cache'
:
return
RamCache
(
id
)
return
RamCache
(
id
_
)
if
cp_meta_type
==
'ERP5 Distributed Ram Cache'
:
## even thougn we have such plugin in ZODB that doens't mean
## we have corresponding memcache module installed
...
...
@@ -85,7 +85,7 @@ class CacheTool(BaseTool):
'server_max_key_length'
:
memcached_plugin
.
getServerMaxKeyLength
(),
'server_max_value_length'
:
memcached_plugin
.
getServerMaxValueLength
(),
'key_prefix'
:
getattr
(
self
,
'erp5_site_global_id'
,
''
)}
return
DistributedRamCache
(
id
,
init_dict
)
return
DistributedRamCache
(
id
_
,
init_dict
)
rd
=
{}
for
cf
in
self
.
objectValues
(
'ERP5 Cache Factory'
):
...
...
@@ -184,7 +184,6 @@ class CacheTool(BaseTool):
assert
REQUEST
is
None
transaction
.
get
().
addBeforeCommitHook
(
self
.
clearCache
,
(
cache_factory_list
,))
ram_cache_root
=
self
.
getRamCacheRoot
()
for
cf_key
in
cache_factory_list
:
self
.
clearCacheFactory
(
cf_key
)
if
REQUEST
is
not
None
:
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.xml
0 → 100644
View file @
33c86fbb
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Tool Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
CacheTool
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.Tool.CacheTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
tool.erp5.CacheTool
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Tool Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml
0 → 100644
View file @
33c86fbb
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Cache Tool"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
portal_caches
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list
View file @
33c86fbb
tool.erp5.AcknowledgementTool
tool.erp5.BuilderTool
tool.erp5.CacheTool
tool.erp5.CallableTool
tool.erp5.ContributionRegistryTool
tool.erp5.DeliveryTool
...
...
product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list
View file @
33c86fbb
mimetypes_registry
portal_acknowledgements
portal_caches
portal_callables
portal_contribution_registry
portal_deliveries
...
...
product/ERP5Type/__init__.py
View file @
33c86fbb
...
...
@@ -88,7 +88,7 @@ import Products.ERP5Type.Workflow
def
initialize
(
context
):
# Import Product Components
from
Tool
import
(
CacheTool
,
MemcachedTool
,
from
Tool
import
(
MemcachedTool
,
TypesTool
,
WebServiceTool
,
PropertySheetTool
,
ComponentTool
)
import
Document
...
...
@@ -102,8 +102,7 @@ def initialize( context ):
content_classes
=
(
Base
,
XMLObject
.
XMLObject
,
ERP5TypeInformation
,
)
portal_tools
=
(
CacheTool
.
CacheTool
,
MemcachedTool
.
MemcachedTool
,
portal_tools
=
(
MemcachedTool
.
MemcachedTool
,
TypesTool
.
TypesTool
,
WebServiceTool
.
WebServiceTool
,
PropertySheetTool
.
PropertySheetTool
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment