Commit 48501ac2 authored by Vincent Pelletier's avatar Vincent Pelletier

Add MemcachedTool.

This tools offers a dictionnary interface to memcached.
As it depends on python-memcached and should not fail silently if the site administrator does not have this python module, this tool is disabled by default.
You can enable it runing "touch Products/ERP5Type/USE_MEMCACHED_TOOL"


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11618 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3f918866
This diff is collapsed.
......@@ -50,13 +50,17 @@ import Products.Localizer # So that we make sure Globals.get_request is availabl
# read permissions for zope - this prevents security holes in
# production environment
class_tool_security_path = '%s%s%s' % (product_path, os.sep, 'ALLOW_CLASS_TOOL')
memcached_tool_enable_path = '%s%s%s' % (product_path, os.sep, 'USE_MEMCACHED_TOOL')
def allowClassTool():
return os.access(class_tool_security_path, os.F_OK)
def allowMemcachedTool():
return os.access(memcached_tool_enable_path, os.F_OK)
def initialize( context ):
# Import Product Components
from Tool import ClassTool, CacheTool
from Tool import ClassTool, CacheTool, MemcachedTool
import Document
import Base, XMLObject
from ERP5Type import ERP5TypeInformation
......@@ -65,7 +69,8 @@ def initialize( context ):
content_constructors = ()
content_classes = ( Base.Base, XMLObject.XMLObject, )
portal_tools = ( ClassTool.ClassTool,
CacheTool.CacheTool, )
CacheTool.CacheTool,
MemcachedTool.MemcachedTool, )
# Do initialization step
initializeProduct(context, this_module, globals(),
document_module = Document,
......
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<h3>Memcached server configuration</h3>
<p>
Memcached Tool provides the programer with an interface to a memcached server.
This interface is similar to a dictionnary.
The server to connet to can be configured below.
Programer can get an interface in his scripts using :
</p>
<pre>portal_memcached.getMemcachedDict(key_prefix=something)</pre>
<p>
<i>something</i> : Must be a string uniquely identifying the usage of memcached, similar to <i>CachingMethod</i>'s id parameter. This allows multiple memcached users to share the same connection to the same memcached server without overwriting other's values.
</p>
<form action="setServerAddress" method="POST">
<input type="text" name="value" value="<dtml-var expr="context.getServerAddress()">">
<br/>
<input type="submit" value="Update server address"/>
</form>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment