[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/cache - __init__.py:1.3 ram.py:1.6 cache.py:NONE

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Aug 19 14:34:54 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/interfaces/cache
In directory cvs.zope.org:/tmp/cvs-serv19346/interfaces/cache

Modified Files:
	__init__.py ram.py 
Removed Files:
	cache.py 
Log Message:
Just to make it worth the effort, here is the rewrite of the Caching Service
to use local utilities. I am amazed how much cruft can go away. There are
still some dead chickens left that can be easily fixed by providing a 
default overview screen for these services and remodeling the local utility
service a bit.

Jim,

noone has complained about the changes yet. Are you guys at ZC having a fit
with it? I think in general people just not use these components heavily
yet and it is no big deal to create them, since their data does not contain
much programming logic (i.e. they are easily recreated) and there are only
a few around ata time usually.


=== Zope3/src/zope/app/interfaces/cache/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/interfaces/cache/__init__.py:1.2	Wed Dec 25 09:12:58 2002
+++ Zope3/src/zope/app/interfaces/cache/__init__.py	Tue Aug 19 13:34:17 2003
@@ -1,2 +1,91 @@
+##############################################################################
 #
-# This file is necessary to make this directory a package.
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Interfaces for cache manager.
+
+$Id$
+"""
+from zope.app import zapi
+from zope.app.interfaces.event import ISubscriber
+from zope.app.services.servicenames import Caching
+from zope.context import ContextProperty
+from zope.interface import Interface
+from zope.schema import TextLine
+
+class CacheName(TextLine):
+    """Cache Name"""
+
+    def __allowed(self):
+        """Note that this method works only if the Field is context wrapped.
+        """
+        service = zapi.queryService(self.context, Caching)
+        if service is None:
+            return ['']
+        else:
+            return [''] + list(service.getAvailableCaches())
+
+    allowed_values = ContextProperty(__allowed)
+
+
+class ICacheable(Interface):
+    """Object that can be associated with a cache manager."""
+
+    cacheId = CacheName(
+        title=u"Cache Name",
+        description=u"The name of the cache used for this object.",
+        required=True)
+
+    def getCacheId():
+        """Gets the associated cache manager ID."""
+
+    def setCacheId(id):
+        """Sets the associated cache manager ID."""
+
+
+class ICachingService(Interface):
+
+    def getCache(name):
+        """Returns a cache object by name."""
+
+    def queryCache(name, default):
+        """Return a cache object by name or default."""
+
+    def getAvailableCaches():
+        """Returns a list of names of cache objects known to this caching
+        service."""
+
+
+class ICache(ISubscriber):
+    """Interface for caches."""
+
+    def invalidate(ob, key=None):
+        """Invalidates cached entries that apply to the given object.
+
+        ob is an object location.  If key is specified, only
+        invalidates entry for the given key.  Otherwise invalidates
+        all entries for the object.
+        """
+
+    def invalidateAll():
+        """Invalidates all cached entries."""
+
+    def query(ob, key=None, default=None):
+        """Returns the cached data previously stored by set().
+
+        ob is the location of the content object being cached.  key is
+        a mapping of keywords and values which should all be used to
+        select a cache entry.
+        """
+
+    def set(data, ob, key=None):
+        """Stores the result of executing an operation."""


=== Zope3/src/zope/app/interfaces/cache/ram.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/interfaces/cache/ram.py:1.5	Sat Jun 21 17:22:10 2003
+++ Zope3/src/zope/app/interfaces/cache/ram.py	Tue Aug 19 13:34:17 2003
@@ -15,10 +15,9 @@
 
 $Id$
 """
-
 from zope.interface import Attribute
 
-from zope.app.interfaces.cache.cache import ICache
+from zope.app.interfaces.cache import ICache
 from zope.app.interfaces.event import ISubscriber
 from zope.app.interfaces.services.registration import IRegisterable
 

=== Removed File Zope3/src/zope/app/interfaces/cache/cache.py ===




More information about the Zope3-Checkins mailing list