Commit 1f54a380 authored by Guido van Rossum's avatar Guido van Rossum

No longer use CLIENT_HOME, INSTANCE_HOME, or ZEO_CLIENT environment

variables.  Updated docstrings/comments.
parent db74d7a5
......@@ -122,16 +122,18 @@ from ZEO.ICache import ICache
magic = 'ZEC1'
headersize = 12
MB = 1024**2
class ClientCache:
__implements__ = ICache
def __init__(self, storage='1', size=20000000, client=None, var=None):
def __init__(self, storage='1', size=20*MB, client=None, var=None):
# Arguments:
# storage -- storage name (used in filenames and log messages)
# size -- size limit in bytes of both files together
# client -- if not None, use a persistent cache file and use this name
# var -- directory where to create persistent cache files
# var -- directory where to create persistent cache files; default cwd
self._storage = storage
self._limit = size / 2
......@@ -145,14 +147,7 @@ class ClientCache:
if client is not None:
# Create a persistent cache
# CLIENT_HOME and INSTANCE_HOME are builtins set by App.FindHomes
if var is None:
try:
var = CLIENT_HOME
except:
try:
var = os.path.join(INSTANCE_HOME, 'var')
except:
var = os.getcwd()
fmt = os.path.join(var, "c%s-%s-%%s.zec" % (storage, client))
......
......@@ -141,16 +141,15 @@ class ClientStorage:
name -- The storage name, defaulting to ''. If this is false,
str(addr) is used as the storage name.
client -- The client name, defaulting to None. If this is
false, the environment value ZEO_CLIENT is used. If the
effective value is true, the client cache is persistent.
See ClientCache for more info.
client -- A name used to construct persistent cache filenames.
Defaults to None, in which case the cache is not persistent.
debug -- Ignored. This is present only for backwards
compatibility with ZEO 1.
var -- The 'var' directory, defaulting to None, in which
the persistent cache files should be written.
var -- When client is not None, this specifies the directory
where the persistent cache files are created. It defaults
to None, in whichcase the current directory is used.
min_disconnect_poll -- The minimum delay in seconds between
attempts to connect to the server, in seconds. Defaults
......@@ -249,7 +248,7 @@ class ClientStorage:
self._oid = '\0\0\0\0\0\0\0\0'
# Decide whether to use non-temporary files
client = client or os.environ.get('ZEO_CLIENT')
client = client
self._cache = self.ClientCacheClass(storage, cache_size,
client=client, var=var)
......
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