[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Caching - Caching.py:1.2

Albertas Agejevas alga@codeworks.lt
Mon, 2 Dec 2002 15:04:17 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Caching
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/App/Caching

Modified Files:
	Caching.py 
Log Message:
Added stats reporting to the RAMCache.
Had to make Zope.App.RDB.ResultSet pickleable on the way.
Renamed ResultSet.names to ResultSet.columns.
Updated SQLScript to pass the location to the cache, not self.


=== Zope3/lib/python/Zope/App/Caching/Caching.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/Caching/Caching.py:1.1	Thu Oct  3 06:37:50 2002
+++ Zope3/lib/python/Zope/App/Caching/Caching.py	Mon Dec  2 15:03:46 2002
@@ -14,7 +14,10 @@
 """Helpers for caching."""
 
 from Zope.ComponentArchitecture import getAdapter, getService
+from Zope.ComponentArchitecture import ComponentLookupError
 from Zope.App.Caching.ICacheable import ICacheable
+from Zope.App.Traversing.IPhysicallyLocatable import IPhysicallyLocatable
+
 
 def getCacheForObj(obj):
     """Returns the cache associated with obj or None."""
@@ -25,3 +28,10 @@
     service = getService(obj, "Caching")
     return service.getCache(cache_id)
 
+def getLocationForCache(obj):
+    """Returns the location to be used for caching the object or None."""
+    try:
+        locatable = getAdapter(obj, IPhysicallyLocatable)
+        return "/".join(locatable.getPhysicalPath())
+    except ComponentLookupError:
+        return None