Commit 69937e65 authored by Julien Muchembled's avatar Julien Muchembled

MemcachedTool: revert "Simplify code."

This reverts commit 8e0674d8.

This fixes a regression in test_Member_download_pdf_format (testDmsWithFlare).
parent f2a0d7d2
......@@ -26,6 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import time
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions, _dtmldir
from AccessControl import ClassSecurityInfo
......@@ -101,6 +102,9 @@ if memcache is not None:
# DELETE_ACTION: delete on server
self.scheduled_action_dict = {}
self.server_list = server_list
# see "Expiration times" from memcached protocol docs
# (this simulates relative expiration time greater than 30 days)
self.expiration_time_since_epoch = expiration_time >= 2592000
self.expiration_time = expiration_time
self.server_max_key_length = server_max_key_length
self.server_max_value_length = server_max_value_length
......@@ -122,6 +126,8 @@ if memcache is not None:
"""
try:
expiration_time = self.expiration_time
if self.expiration_time_since_epoch:
expiration_time += time.time()
for key, value in self.local_cache.iteritems():
if getattr(value, MEMCACHED_TOOL_MODIFIED_FLAG_PROPERTY_ID, None):
delattr(value, MEMCACHED_TOOL_MODIFIED_FLAG_PROPERTY_ID)
......
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