[Zope-CVS] CVS: Products/FileCacheManager - FileCache.py:1.6
Chris McDonough
chrism at plope.com
Sun Aug 29 15:03:07 EDT 2004
Update of /cvs-repository/Products/FileCacheManager
In directory cvs.zope.org:/tmp/cvs-serv22323
Modified Files:
FileCache.py
Log Message:
Use a 3-level default cache instead of 2-level.
=== Products/FileCacheManager/FileCache.py 1.5 => 1.6 ===
--- Products/FileCacheManager/FileCache.py:1.5 Sat Aug 28 22:32:09 2004
+++ Products/FileCacheManager/FileCache.py Sun Aug 29 15:03:06 2004
@@ -55,7 +55,7 @@
else:
phys_path = '/'.join(ob.getPhysicalPath())[1:]
hashed = md5.new(phys_path).hexdigest()
- fname = os.path.join(self._dir, hashed[:2], hashed)
+ fname = os.path.join(self._dir, hashed[:2], hashed[:3], hashed)
return fname
@@ -146,17 +146,19 @@
""" Make sure we have somewhere to put files. """
chars = '0123456789abcdef'
- for char in chars:
+ for char1 in chars:
for char2 in chars:
- dirpath = os.path.join(self._dir, '%s%s' % (char, char2))
- try:
- os.makedirs(dirpath)
- except OSError, why:
- # it might have already been created
- if not os.path.isdir(dirpath):
- zLOG.LOG('FileCacheManager', zLOG.PROBLEM,
- 'unable to create directory %s' % dirpath,
- error=sys.exc_info())
+ for char3 in chars:
+ dirpath = os.path.join(self._dir, '%s%s' % (char1, char2),
+ '%s%s%s' % (char1, char2, char3))
+ try:
+ os.makedirs(dirpath)
+ except OSError, why:
+ # it might have already been created
+ if not os.path.isdir(dirpath):
+ zLOG.LOG('FileCacheManager', zLOG.PROBLEM,
+ 'unable to create directory %s' % dirpath,
+ error=sys.exc_info())
class FileCacheEntry:
More information about the Zope-CVS
mailing list