Commit 3297d136 authored by Vincent Pelletier's avatar Vincent Pelletier

Expose pseudo-API to clear app's cache.

This is used by zodbshootout, for example, to only flush storage's cache.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2422 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 025d1456
......@@ -29,6 +29,13 @@ def check_read_only(func):
return func(self, *args, **kw)
return wrapped
class DummyCache(object):
def __init__(self, app):
self.app = app
def clear(self):
self.app.mq_cache.clear()
class Storage(BaseStorage.BaseStorage,
ConflictResolution.ConflictResolvingStorage):
"""Wrapper class for neoclient."""
......@@ -44,6 +51,7 @@ class Storage(BaseStorage.BaseStorage,
self._is_read_only = read_only
self.app = Application(master_nodes, name, connector,
compress=compress)
self._cache = DummyCache(self.app)
def load(self, oid, version=None):
try:
......
......@@ -147,16 +147,19 @@ class MQ(object):
def __init__(self, life_time=10000, buffer_levels=9,
max_history_size=100000, max_size=20*1024*1024):
self._life_time = life_time
self._buffer_levels = buffer_levels
self._max_history_size = max_history_size
self._max_size = max_size
self.clear()
def clear(self):
self._history_buffer = FIFO()
self._cache_buffers = []
for level in range(buffer_levels):
for level in range(self._buffer_levels):
self._cache_buffers.append(FIFO())
self._data = {}
self._time = 0
self._life_time = life_time
self._buffer_levels = buffer_levels
self._max_history_size = max_history_size
self._max_size = max_size
self._size = 0
def has_key(self, key):
......
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