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
Nikola Balog
erp5
Commits
b21146a8
Commit
b21146a8
authored
May 13, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ERP5Type] Support 'Cache-Control: must-revalidate' in Accelerated HTTP Cache Manager
parent
26d1f5dd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
0 deletions
+87
-0
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/anonymous_http_cache.xml
...rp5_xhtml_style/PathTemplateItem/anonymous_http_cache.xml
+4
-0
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/http_cache.xml
...ootstrap/erp5_xhtml_style/PathTemplateItem/http_cache.xml
+4
-0
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/must_revalidate_http_cache.xml
...tml_style/PathTemplateItem/must_revalidate_http_cache.xml
+61
-0
product/ERP5/bootstrap/erp5_xhtml_style/bt/template_path_list
...uct/ERP5/bootstrap/erp5_xhtml_style/bt/template_path_list
+1
-0
product/ERP5Type/dtml/propsAccel.dtml
product/ERP5Type/dtml/propsAccel.dtml
+11
-0
product/ERP5Type/patches/AcceleratedHTTPCacheManager.py
product/ERP5Type/patches/AcceleratedHTTPCacheManager.py
+6
-0
No files found.
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/anonymous_http_cache.xml
View file @
b21146a8
...
...
@@ -22,6 +22,10 @@
<key>
<string>
interval
</string>
</key>
<value>
<int>
3600
</int>
</value>
</item>
<item>
<key>
<string>
must_revalidate
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
notify_urls
</string>
</key>
<value>
...
...
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/http_cache.xml
View file @
b21146a8
...
...
@@ -22,6 +22,10 @@
<key>
<string>
interval
</string>
</key>
<value>
<int>
3600
</int>
</value>
</item>
<item>
<key>
<string>
must_revalidate
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
notify_urls
</string>
</key>
<value>
...
...
product/ERP5/bootstrap/erp5_xhtml_style/PathTemplateItem/must_revalidate_http_cache.xml
0 → 100644
View file @
b21146a8
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"AcceleratedHTTPCacheManager"
module=
"Products.StandardCacheManagers.AcceleratedHTTPCacheManager"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_AcceleratedHTTPCacheManager__cacheid
</string>
</key>
<value>
<string>
139793752921944_1557734604.715313
</string>
</value>
</item>
<item>
<key>
<string>
_settings
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
anonymous_only
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
interval
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
must_revalidate
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
notify_urls
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
public
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
stale_if_error_interval
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
stale_while_revalidate_interval
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
must_revalidate_http_cache
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_xhtml_style/bt/template_path_list
View file @
b21146a8
anonymous_http_cache
http_cache
must_revalidate_http_cache
user_ram_cache
\ No newline at end of file
product/ERP5Type/dtml/propsAccel.dtml
View file @
b21146a8
...
...
@@ -59,6 +59,17 @@
public> checked="checked"</dtml-if> />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Must-Revalidate?
</div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="must_revalidate" value="1"<dtml-if
must_revalidate> checked="checked"</dtml-if> />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
...
...
product/ERP5Type/patches/AcceleratedHTTPCacheManager.py
View file @
b21146a8
...
...
@@ -42,6 +42,8 @@ def ZCache_set(self, ob, data, view_name, keywords, mtime_func):
%
(
self
.
stale_while_revalidate_interval
))
if
getattr
(
self
,
'public'
,
0
):
cache_control_parameter
.
append
(
'public'
)
if
getattr
(
self
,
'must_revalidate'
,
0
):
cache_control_parameter
.
append
(
'must-revalidate'
)
RESPONSE
.
setHeader
(
'Last-Modified'
,
rfc1123_date
(
time
.
time
()))
RESPONSE
.
setHeader
(
'Cache-Control'
,
", "
.
join
(
cache_control_parameter
))
RESPONSE
.
setHeader
(
'Expires'
,
expires
)
...
...
@@ -59,6 +61,7 @@ def __init__(self, ob_id):
'stale_if_error_interval'
:
300
,
'stale_while_revalidate'
:
10
,
'public'
:
1
,
'must_revalidate'
:
0
,
'notify_urls'
:
()}
self
.
_resetCacheId
()
...
...
@@ -73,6 +76,7 @@ def manage_editProps(self, title, settings=None, REQUEST=None):
'stale_if_error_interval'
:
int
(
settings
[
'stale_if_error_interval'
]),
'stale_while_revalidate_interval'
:
int
(
settings
[
'stale_while_revalidate_interval'
]),
'public'
:
settings
.
get
(
'public'
)
and
1
or
0
,
'must_revalidate'
:
settings
.
get
(
'must_revalidate'
)
and
1
or
0
,
'notify_urls'
:
tuple
(
settings
[
'notify_urls'
])}
cache
=
self
.
ZCacheManager_getCache
()
cache
.
initSettings
(
self
.
_settings
)
...
...
@@ -90,6 +94,8 @@ def getSettings(self):
self
.
_settings
.
update
({
'stale_while_revalidate_interval'
:
0
})
if
'public'
not
in
self
.
_settings
:
self
.
_settings
.
update
({
'public'
:
0
})
if
'must_revalidate'
not
in
self
.
_settings
:
self
.
_settings
.
update
({
'must_revalidate'
:
0
})
return
self
.
_settings
.
copy
()
# Don't let UI modify it.
...
...
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