Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
7aeacb94
Commit
7aeacb94
authored
Jan 09, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added StandardCacheManagers product to trunk.
parent
294ea060
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1179 additions
and
0 deletions
+1179
-0
lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
...ucts/StandardCacheManagers/AcceleratedHTTPCacheManager.py
+306
-0
lib/python/Products/StandardCacheManagers/RAMCacheManager.py
lib/python/Products/StandardCacheManagers/RAMCacheManager.py
+482
-0
lib/python/Products/StandardCacheManagers/__init__.py
lib/python/Products/StandardCacheManagers/__init__.py
+110
-0
lib/python/Products/StandardCacheManagers/addAccel.dtml
lib/python/Products/StandardCacheManagers/addAccel.dtml
+14
-0
lib/python/Products/StandardCacheManagers/addRCM.dtml
lib/python/Products/StandardCacheManagers/addRCM.dtml
+14
-0
lib/python/Products/StandardCacheManagers/cache.gif
lib/python/Products/StandardCacheManagers/cache.gif
+0
-0
lib/python/Products/StandardCacheManagers/help/Accel.stx
lib/python/Products/StandardCacheManagers/help/Accel.stx
+66
-0
lib/python/Products/StandardCacheManagers/help/RAM.stx
lib/python/Products/StandardCacheManagers/help/RAM.stx
+47
-0
lib/python/Products/StandardCacheManagers/propsAccel.dtml
lib/python/Products/StandardCacheManagers/propsAccel.dtml
+37
-0
lib/python/Products/StandardCacheManagers/propsRCM.dtml
lib/python/Products/StandardCacheManagers/propsRCM.dtml
+37
-0
lib/python/Products/StandardCacheManagers/statsAccel.dtml
lib/python/Products/StandardCacheManagers/statsAccel.dtml
+28
-0
lib/python/Products/StandardCacheManagers/statsRCM.dtml
lib/python/Products/StandardCacheManagers/statsRCM.dtml
+37
-0
lib/python/Products/StandardCacheManagers/version.txt
lib/python/Products/StandardCacheManagers/version.txt
+1
-0
No files found.
lib/python/Products/StandardCacheManagers/AcceleratedHTTPCacheManager.py
0 → 100644
View file @
7aeacb94
This diff is collapsed.
Click to expand it.
lib/python/Products/StandardCacheManagers/RAMCacheManager.py
0 → 100644
View file @
7aeacb94
This diff is collapsed.
Click to expand it.
lib/python/Products/StandardCacheManagers/__init__.py
0 → 100644
View file @
7aeacb94
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
'''
Some standard Zope cache managers from Digital Creations.
$Id$
'''
import
RAMCacheManager
import
AcceleratedHTTPCacheManager
def
initialize
(
context
):
context
.
registerClass
(
RAMCacheManager
.
RAMCacheManager
,
constructors
=
(
RAMCacheManager
.
manage_addRAMCacheManagerForm
,
RAMCacheManager
.
manage_addRAMCacheManager
),
icon
=
"cache.gif"
)
context
.
registerClass
(
AcceleratedHTTPCacheManager
.
AcceleratedHTTPCacheManager
,
constructors
=
(
AcceleratedHTTPCacheManager
.
manage_addAcceleratedHTTPCacheManagerForm
,
AcceleratedHTTPCacheManager
.
manage_addAcceleratedHTTPCacheManager
),
icon
=
"cache.gif"
)
context
.
registerHelp
()
lib/python/Products/StandardCacheManagers/addAccel.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
Add Accelerated HTTP Cache Manager
</title></head>
<body
bgcolor=
"#ffffff"
>
<h2>
Add Accelerated HTTP Cache Manager
</h2>
<form
action=
"manage_addAcceleratedHTTPCacheManager"
method=
"POST"
>
<table>
<tr>
<th>
Id
</th>
<td><input
type=
"text"
name=
"id"
></td>
</tr>
</table>
<input
type=
"submit"
name=
"submit"
value=
"Add"
>
</form>
</body>
</html>
lib/python/Products/StandardCacheManagers/addRCM.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
Add RAM Cache Manager
</title></head>
<body
bgcolor=
"#ffffff"
>
<h2>
Add RAM Cache Manager
</h2>
<form
action=
"manage_addRAMCacheManager"
method=
"POST"
>
<table>
<tr>
<th>
Id
</th>
<td><input
type=
"text"
name=
"id"
></td>
</tr>
</table>
<input
type=
"submit"
name=
"submit"
value=
"Add"
>
</form>
</body>
</html>
lib/python/Products/StandardCacheManagers/cache.gif
0 → 100644
View file @
7aeacb94
158 Bytes
lib/python/Products/StandardCacheManagers/help/Accel.stx
0 → 100644
View file @
7aeacb94
Accelerated HTTP Cache Managers
For background information, see the
<a href="../../../OFSP/Help/Caching.stx">description of cache management</a>.
The HTTP protocol provides for headers that can indicate to
downstream proxy caches, browser caches, and dedicated caches that
certain documents and images are cacheable. Most images, for example,
can safely be cached for a long time. Anonymous visits to most
primary pages can be cached as well.
An accelerated HTTP cache manager lets you control the headers that
get sent with the responses to requests so that downstream caches
will know what to cache and for how long. This allows you to reduce
the traffic to your site and handle larger loads than otherwise
possible. You can associate accelerated HTTP cache managers with
any kind of cacheable object that can be viewed through the web.
The main risk in using an accelerated HTTP cache manager involves
a part of a page setting headers that apply to the whole response.
If, for example, your home page contains three parts that are
cacheable and one of those parts is associated with an accelerated
HTTP cache manager, Zope will return the headers set by the part of
the page, making downstream caches think that the whole page should
be cached.
The workaround is simple: don't use an accelerated HTTP cache manager
with objects that make up parts of a page unless you really know
what you're doing.
There are some parameters available for accelerated HTTP cache managers.
The interval is the number of seconds the downstream caches should
cache the object. 3600 seconds, or one hour, is a good default.
If you find that some objects need one interval and other objects
should be set to another interval, use multiple cache managers.
If you set the *cache anonymous connections only* checkbox, you
will reduce the possibility of caching private data.
The *notify URLs* parameter allows you to specify the URLs of
specific downstream caches so they can receive invalidation messages
as 'PURGE' directives. Dedicated HTTP cache software such
as Squid will clear cached data for a given URL when receiving the
'PURGE' directive. (More details below.)
Simple statistics are provided. Remember that the only time Zope
receives a request that goes through an HTTP cache is when the
HTTP cache had a *miss*. So the hits seen by Zope correspond to
misses seen by the HTTP cache. To do traffic analysis, you should
consult the downstream HTTP caches.
When testing the accelerated HTTP cache manager, keep in mind that
the *reload* button on most browsers causes the 'Pragma: no-cache'
header to be sent, forcing HTTP caches to reload the page as well.
Try using telnet, netcat, or tcpwatch to observe the headers.
To allow Zope to execute the Squid PURGE directive, make sure the
following lines or the equivalent are in squid.conf (changing
'localhost' to the correct host name if Squid is on a different
machine)::
acl PURGE method purge
http_access allow localhost
http_access allow purge localhost
http_access deny purge
http_access deny all
lib/python/Products/StandardCacheManagers/help/RAM.stx
0 → 100644
View file @
7aeacb94
RAM Cache Managers
For background information, see the
<a href="../../../OFSP/Help/Caching.stx">description of cache management</a>.
The RAM cache manager allows you to cache the result of calling DTML
methods, Python scripts, and SQL methods in memory. It allows you
to cache entire pages as well as parts of pages. It provides
access statistics and simple configuration options.
Storing the result in memory results in the fastest possible cache
retrieval, but carries some risks. Unconstrained, it can consume too
much RAM. And it doesn't reduce network traffic, it only helps
Zope return a result more quickly.
Fortunately, RAM cache managers have tunable parameters. You can
configure the threshold on the number of entries that should be in
the cache, which defaults to 1000. Reduce it if the cache is taking
up too much memory or increase it if entries are being cleared too
often.
You can also configure the cleanup interval. If the RAM cache is
fluctuating too much in memory usage, reduce the cleanup interval.
Finally, you can configure the list of REQUEST variables that will
be used in the cache key. This can be a simple and effective way
to distinguish requests from authenticated versus anonymous users
or those with session cookies.
If you find that some of your objects need certain cache parameters
while others need somewhat different parameters, create multiple
RAM cache managers.
The 'Statistics' tab allows you to view a summary of the contents
of the cache. Click the column headers to re-sort the list, twice
to sort backwards. You can use the statistics to gauge the
benefit of caching each of your objects. For a given object, if
the number of hits is less than or not much greater than the number
of misses, you probably need to re-evaluate how that object is
cached.
Although Zope does not prevent you from doing so, it generally does
not make sense to associate an image or a file object with a RAM
cache manager. It will not cache the image or file data, since the
data is already available in RAM. However, another kind of cache
manager, an *accelerated HTTP cache manager*, is available and is
suitable for images and file objects.
lib/python/Products/StandardCacheManagers/propsAccel.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
Accelerated HTTP Cache Manager properties
</title></head>
<body
bgcolor=
"#ffffff"
>
<dtml-var
manage_tabs
>
<h2>
Properties
</h2>
<form
action=
"manage_editProps"
method=
"POST"
>
<dtml-with
getSettings
mapping
>
<table>
<tr>
<th
valign=
"top"
align=
"left"
>
Id
</th>
<td>
&dtml-id;
</td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Title
</th>
<td><input
type=
"text"
name=
"title"
value=
"&dtml-title;"
></td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Interval (seconds)
</th>
<td><input
type=
"text"
name=
"interval"
value=
"&dtml-interval;"
></td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Cache anonymous connections only
</th>
<td><input
type=
"checkbox"
name=
"anonymous_only"
value=
"1"
<
dtml-if
anonymous_only
>
checked="checked"
</dtml-if>
>
</td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Notify URLs (via PURGE)
</th>
<td><textarea
name=
"notify_urls:lines"
rows=
"5"
cols=
"30"
><dtml-in
notify_urls
>
&dtml-sequence-item;
</dtml-in></textarea></td>
</tr>
</table>
</dtml-with>
<input
type=
"submit"
name=
"submit"
value=
"Save"
>
</form>
</body>
</html>
lib/python/Products/StandardCacheManagers/propsRCM.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
RAMCacheManager properties
</title></head>
<body
bgcolor=
"#ffffff"
>
<dtml-var
manage_tabs
>
<h2>
Properties
</h2>
<form
action=
"manage_editProps"
method=
"POST"
>
<dtml-with
getSettings
mapping
>
<table>
<tr>
<th
valign=
"top"
align=
"left"
>
Id
</th>
<td>
&dtml-id;
</td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Title
</th>
<td><input
type=
"text"
name=
"title"
value=
"&dtml-title;"
></td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
REQUEST variables
</th>
<td><textarea
name=
"request_vars:lines"
rows=
"5"
cols=
"30"
><dtml-in
request_vars
>
&dtml-sequence-item;
</dtml-in></textarea></td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Threshold entries
</th>
<td><input
type=
"text"
name=
"threshold"
value=
"&dtml-threshold;"
></td>
</tr>
<tr>
<th
valign=
"top"
align=
"left"
>
Cleanup interval (seconds)
</th>
<td><input
type=
"text"
name=
"cleanup_interval"
value=
"&dtml-cleanup_interval;"
></td>
</tr>
</table>
</dtml-with>
<input
type=
"submit"
name=
"submit"
value=
"Save"
>
</form>
</body>
</html>
lib/python/Products/StandardCacheManagers/statsAccel.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
AcceleratedHTTPCacheManager statistics
</title></head>
<body
bgcolor=
"#ffffff"
>
<dtml-var
manage_tabs
>
<h2>
Statistics
</h2>
<table>
<tr>
<td><dtml-var
expr=
"sort_link('Path', 'path')"
></td>
<td><dtml-var
expr=
"sort_link('Anonymous hits', 'anon')"
></td>
<td><dtml-var
expr=
"sort_link('Authenticated hits', 'auth')"
></td>
</tr>
<dtml-in
getCacheReport
mapping
>
<tr>
<td><a
href=
"&dtml-path;/ZCacheable_manage"
>
&dtml-path;
</a></td>
<td>
&dtml-anon;
</td>
<td>
&dtml-auth;
</td>
</tr>
<dtml-else>
<tr><td
colspan=
"3"
><i>
Nothing is in the cache.
</i></td></tr>
</dtml-in>
</table>
<p><i>
Notes
</i></p>
<ul>
<li>
Cache manager hits generally correspond to HTTP accelerator misses.
</li>
<li>
A hit is counted in the "authenticated hits" column even if
headers are only set for anonymous requests.
</li>
</ul>
</body>
</html>
lib/python/Products/StandardCacheManagers/statsRCM.dtml
0 → 100644
View file @
7aeacb94
<html><head><title>
RAMCacheManager statistics
</title></head>
<body
bgcolor=
"#ffffff"
>
<dtml-var
manage_tabs
>
<h2>
Statistics
</h2>
<table>
<tr>
<td><dtml-var
expr=
"sort_link('Path', 'path')"
></td>
<td><dtml-var
expr=
"sort_link('Hits', 'hits')"
></td>
<td><dtml-var
expr=
"sort_link('Recent hits', 'counter')"
></td>
<td><dtml-var
expr=
"sort_link('Misses', 'misses')"
></td>
<td><dtml-var
expr=
"sort_link('Memory', 'size')"
></td>
<td><dtml-var
expr=
"sort_link('Views', 'views')"
></td>
<td><dtml-var
expr=
"sort_link('Entries', 'entries')"
></td>
</tr>
<dtml-in
getCacheReport
mapping
>
<tr>
<td><a
href=
"&dtml-path;/ZCacheable_manage"
>
&dtml-path;
</a></td>
<td>
&dtml-hits;
</td>
<td>
&dtml-counter;
</td>
<td>
&dtml-misses;
</td>
<td>
&dtml-size;
</td>
<td><dtml-var
expr=
"_.string.join(views, ', ')"
html_quote
></td>
<td>
&dtml-entries;
</td>
</tr>
<dtml-else>
<tr><td
colspan=
"7"
><i>
Nothing is in the cache.
</i></td></tr>
</dtml-in>
</table>
<ul>
<li>
Memory usage is approximate. It is based on the pickled value of the
cached data.
</li>
<li>
The cache is cleaned up by removing the least frequently accessed
entries since the last cleanup operation. The determination is made using
the
<i>
Recent hits
</i>
counter.
</li>
</ul>
</body>
</html>
lib/python/Products/StandardCacheManagers/version.txt
0 → 100644
View file @
7aeacb94
StandardCacheManagers-0-1
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